How do I find the real zeros of a function?
2 Answers
It depends...
Explanation:
Here are some cases...
Polynomial with coefficients with zero sum
If the sum of the coefficients of a polynomial is zero then
Any polynomial with rational roots
Any rational zeros of a polynomial with integer coefficients of the form
Polynomials with degree <= 4
#ax+b = 0 => x = -b/a#
#ax^2+bx+c = 0 => x = (-b+-sqrt(b^2-4ac))/(2a)#
There are formulas for the general solution to a cubic, but depending on what form you want the solution in and whether the cubic has
In the case of one Real root and two Complex ones, my preferred method is Cardano's method. The symmetry of this method gives neater result formulations than Vieta's substitution.
In the case of three Real roots, it may be preferable to use the trigonometric substitution that squeezes a cubic into the identity
There are general formulas for the solution of quartic equations, but it's generally easier to work with the individual cases.
In the worst cases, you can transform
#t^4+pt^2+qt+r = (t^2+At+B)(t^2-At+C)#
multiplying out and equating coefficients to get 3 simultaneous equations in
If algebraic solutions are not usable, try Newton's method or similar to find numeric approximations.
Explanation:
Quintics and other more complicated functions
If
Starting with an approximation
#a_(i+1) = a_i - f(a_i)/(f'(a_i))#
For example, if
#a_(i+1) = a_i - (a_i^5+a_i+3)/(5a_i^4+1)#
Putting this into a spreadsheet with
#a_0=-1#
#a_1 = -1.166666666666667#
#a_2 = -1.134701651504899#
#a_3 = -1.133002126375077#
#a_4 = -1.132997565917805#
#a_5 = -1.132997565885065#
#a_6 = -1.132997565885065#
If
Newton's method can also be used to find Complex zeros in a similar way, but you may prefer to use methods like Durand-Kerner to find all zeros at once.