Press space, then input the coefficients of your polynomial (starting with the constant). Increase the accuracy slider for better results. Scratch can not handle very high accuracy. If the code doesn't break in less than 3 seconds, press the stop button. Then, decrease your accuracy and try again. When the code stops, your solutions are in the Roots Found list at right. Definitions: -C0 is the coefficients of the original polynomial. -C1 is the coefficients of the polynomial's derivative. -Poly0 is the equation of the original polynomial. -Poly1 is the equation of the polynomial's derivative. -RRange0 is the range from 0 all roots of the original polynomial must lie. -RRange1 is the range from 0 all roots of the polynomial's derivative must lie. -Accuracy is adjustable from 5 to 15, 5 being least accurate and 15 being most accurate. The majority of polynomials yield best results using accuracy 15, with few that requires less. -Roots Found is the list where all found roots are stored. Roots are where a polynomial intersects the x-axis. You will find BREAK at the end of this list, signifying the code has stopped searching for more roots. The search usually takes a fraction of a second. If it takes longer, then press the stop button. If you are unable to scroll through this list, go into the editor to open up results. -Critical Points Found is the list where found critical points are stored. Critical points are where a polynomial has slope 0. The rest is similar to Roots Found.
Disclaimer! This method fails when: -coefficients are large Features: -with high accuracy, the exact values of roots can be found, expressing repeating decimals using bar notation -when the graph is tangent to the x-axis, the code checks for critical points and tests the values there -constant polynomials (y=c) will yield the output ALL COMPLEX NUMBERS for critical points (and roots if c=0). How it works: The code starts by accepting user inputs, storing them in C0. Once the user has finished, a polynomial is constructed purely for visual purposes, as the math only requires the list C0. Then, RRange0 is calculated by taking the number with the largest absolute value from C0, dividing it by the absolute value of last number. Search Cauchy Bound for more information. Then, starting from var2=-RRange0, the code evaluates the polynomial at var2, marking the sign (+/-) of the output. Then, increasing var2 by small amounts the code continues evaluate the polynomial until the sign switches. According to the Intermediate Value Theorem (and intution), there must be a root between this var2 and the previous var2. Backtracking by smaller values, the code decreases var2 until the sign flips again. This process is repeated until the |Evaluation|<10^-Accuracy. The value of var2 is added to Roots Found. Then, var2 is increased by by a tiny amount, passing the root, and the code continues to the right until more roots are found. The code stops when var2>RRange0, signifying there cannot be more roots beyond. BREAK is added to Roots Found to clarify. There is a possibility that the code misses a root where the polynomial is tangent to the x-axis, since the signs never flip. However, this is a simple fix. The code evaluates the derivative of Poly0 (and lets this equal Poly1). RRange1 is calculated, and a similar process evaluates the roots of Poly1. Where Poly1=0 is a critical point. Since tangent roots are also always critical points, the code evaluates Poly0 at these critical points. If |Evaluation|<10^-Accuracy, the critical point is added to Roots Found. Now, there it is still possible, but unlikely, that Poly1 is also tangent to the x-axis. In this case, the code fails to find the root. (I will fix this in the future.) Finally, the code simplifies the roots found. If values contain values such as 10e-15, 1.999999999, or 2.1666666666, they are reasoned to be 0, 2, and 2.16̅, respectively. Numbers with bars over them, such as 6̅, are typed using Combining Overline.