I’m trying to code a quadratic equation with the ability to find the min and max at the same time within a given range. Later these points can be used to start adding structure too but I’m having trouble getting the code started. Eventually I’d like to find min/max of a series of sin waves but will start will quadratic equations first. Thanks,

def quadmin(a, b, c, xmin, xmax);

q0 = (a * xmin + b) * xmin + c;

q2 = (a * xmin + b) * xmax + c;

x1 = -b/(2*a);

if (xmin < x1 ) and (x1 < xmax);

q1 = (a * x1 + b) * x1 +c;

return min(q0, q1, q2);

else

return min(q0, q2);