繁体   English   中英

求二次方程的最大值和最小值

[英]Finding the maximum and minimum value of a quadratic equation

所以我编写了一个程序来计算二次方程的零点,但我需要帮助制定方法来找到最大/最小值、极值点坐标以及它是最大值还是最小值。 感谢所有帮助!

a = float(input("enter the value of coefficient 'a':   "))

b  = float(input("enter the value of coefficient 'b':  "))

c  = float(input("enter the value of coefficient 'c':  "))

z = ( b**2) - (4*a*c)

z2 = ( ( z**(1/2) )    -b )/2*a

z3 = ( -( z**(1/2) )    -b )/2*a


z4 = (-b)/2*a

z5 = (-z)/4*a

if a!=0:

    if a>0:

        print("the concavity of the parabola is facing upwards")

    else:

        print("the concavity of the parabola is facing downwards")


print("the square roots are: ", z2," and ", z3)

print("the coordinate of the maximum point is:", "( ",z4," ",z5," )")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM