Overview | Seeds etc | User guide | Main Window | Musical note intervals | Scales | Midi in | Analyse sound |
Back to: How FTS finds the solution
You can use this page to try out the algebraic solution of the cubic, and the iterative one.
You can start the iteration at any value close to the expected solution. It also works well to choose a large value such as 1000.
Enter values for all the coefficients. If one of them is zero, enter 0 as its value. If you leave one of the boxes blank, you will get NaN as the result (not a number).
When you have a solution, the Value at solution will be 0, or very small.
A value ending in e-15 is very small (this means there are 14 zeroes before the first significant figure)
The solution is often as accurate as for the analytic method (for limitations see below). However, it will only find one. If you think there may be several solutions, try using other starting values to find them all.
Looks for real valued solutions, i.e. ones that don't need square roots of negative numbers. A cubic equation changes sign, provided the r 3 coefficient is non zero. So such equations always have at least one real valued solution.
If the r 3 coefficient is 0, it uses the analytic solution for a quadratic. Finds the maximum of the two roots, if any. For the quadratic, there needn't always be any solutions, for instance, x 2 + 1 doesn't have a real valued solution; its only solutions are i and -i where i is the square root of -1.
Newton's method:
Find x2 = x - f(x)/f'(x) Then set x = x2 and repeat the process. Keep going until the new value for x is very close to the previous one.
The java script for this page keeps going until the step is less than 10 -15 .
Subdivision method:
Looks for a change of sign between 2 24 and -2 24 , starting from the highest value, and going down by steps of 2 20 . Stops just before change of sign, divides the step by 4, and repeats the process. Does this 40 times - max of 160 loops.
This will work if there is at least one change of sign.
Limitations:
When there are several solutions, only finds one. Try using Newton's method with other start values to find the other solutions.
Method is iterative rather than analytic. It finds the root as a value of x for which the cubic evaluates to 0. This works well if the cubic slopes near the root.
Some cubics like x 3 - 3 x 2 + 3 x - 1 have very gentle slopes close to the place where they reach zero (because first derivative is zero at the root).
Result is that there is a fairly large range of values that evaluate to 0 with 15 digit precision numbers.
For cubics with such a gentle slope, the method used can only find the first five or so digits of the correct solution.
Often the solution one wants is an integer. So, to help deal with gentle slopes, the applet tries the nearest whole number to the calculated solution. If the value of the cubic at that point is as close to zero as it is for the calculated solution, it uses the whole number by preference.
So for instance, it will show 3 instead of 3.0000000000000004, if the cubic evaluates to 0 at both points when using 15 digit precision numbers.
When the derivative is zero at the root, one way to get more precision is to differentiate, and find the zero of the derivative at that point.
The derivative and integral buttons are to help with this. They save some typing by finding the formal derivative / integral for you.
When you integrate, the constant coefficient is set to 0. If you integrate an equation with non zero x 3 coefficient, then the result is of course a quartic, and the x 4 coefficient will be left out.