-3

How can I minimize or maximize a quadratic function? what is the algorithm for that?

Thanks!

AdyM
  • 13
  • 4

1 Answers1

0

If you're talking about polynomials of degree in the form

y = a·x² + b·x + c

There's a very simple, closed solution for that. Take the arithmetic average of the the two roots as given by the general solution

x1,2 = (-b +/- sqrt(b² + 4·a·c)) / 2·a

That gives you the x value for the min or max.

Take the 2nd derivative of the polynomial to see if its a minimum or a maximum.

All of these have simple closed solution, but this reeks of homework, so I want you do to something.

datenwolf
  • 159,371
  • 13
  • 185
  • 298