How can I use the programming language to find the vertices of a quadratic equation?
How can I use the programming language to find the vertices of a quadratic equation? For example, I have an equation like this.
Y=3X**212X+4
Although I can use the following way to find the minimum value of Y
x=np.arange(100,101,1)
y=3*np.power(x,2)12*x+4
print(np.min(y))
But then I don't know how to use the program to find the X value, I can only solve the problem using mathematical equations, so please help, thank you.
import matplotlib.pyplot as plt
import numpy as np
x=np.arange(100,101,1)
y=3*np.power(x,2)12*x+4
print(np.min(y))
'''
8=3x**212x+4
12=3x**212x
12=3(x**24x)
4=x**24x
0=x**24x+4
0=x**22*2x+2**2
0=(x2)**2
'''
plt.plot(x,y)
plt.grid()
plt.show()
2 answers

use argmin (link)
x[ y.argmin() ]

Sorry，I have other questions,but I can not post questions。 For the differential derivative of 2x^43x^2+2x20, I can solve the problem in the way of programming language, but I can't do it in the next x=1, please help, thank you. When x has a value of 1, what is the value of the derivative? Code：
from sympy import Symbol,Derivative import numpy as np x=Symbol('x') y=2*np.power(x,4)3*np.power(x,2)+2*x20 y2=y.diff(x) print(y2.__class__) #When x has a value of 1, what is the value of the derivative? f=Derivative((y,x,1)).doit() print(f)