<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/* Min value of q(x) = x^2 + bx + c on interval [L,R]
 */
public class MinQuadratic {
  public static void main(String[] args) {
    final double b=2, c=-1.5;
    double L=-3, R=5;
    double qMin, qL, qR;  // Min value of q, q(L), q(R)
        
    double xc= -b/2;
    if (L&lt;=xc &amp;&amp; xc&lt;=R)
      // qMin is q(xc)
      qMin= xc*xc + b*xc + c;
    else {
      // qMin is q(L) or q(R)
      qL= L*L + b*L + c;
      qR= R*R + b*R + c;
      if (qL &lt; qR)
        qMin= qL;
      else
        qMin= qR;
    }
    
    System.out.println("Min value is " + qMin);
  }
}



/* To have user input, replace line 6 above with the following statements.
 * You'll also need to import the Scanner class.
 * 
    Scanner keyboard= new Scanner(System.in);
    System.out.print("Enter left bound L: ");
    double L= keyboard.nextDouble();
    System.out.print("Enter right bound R: ");
    double R= keyboard.nextDouble();
 */</pre></body></html>