I am trying to solve a cubic equation in Python. However I am getting only one root of the equation. Please find the code snippet below.
import numpy as np from scipy import optimize as op def my_func(p): k = 0.17 d = 3e-6 A = 1.6e-9 epsilon = 8.85e-12 Vspi = np.sqrt((8*k*np.power(d,3))/(27*epsilon*A)) Vdc = 0.2 * Vspi xeq = p F = (k*np.power(xeq,3))-(2*k*d*np.power(xeq,2))+(2*k*np.power(d,2)*xeq)-(epsilon*A*np.power(Vdc,2)) return F zguess = 0.5e-6 z = op.fsolve(my_func,zguess) print(z)
What is the mistake ? I am supposed to obtain three roots.