Cubic and Quartic Formulae - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Cubic and Quartic Formulae (/thread-4487.html) |
Cubic and Quartic Formulae - LCieParagon - 08-06-2015 05:35 AM Hello everyone, I am just wondering if anyone has a program / application to find the exact roots of cubic and quartic polynomials. I'm well aware that the calculator can solve them, but they provide decimal, approximate answers. These formulae have been known since the 1500s. I wish the HP Prime and TI calculators provided exact solutions. Only linear (trivial) and quadratic equations provide exact answers for all values of a, b, c. Cubic formula: https://en.wikipedia.org/wiki/Cubic_function#General_formula_for_roots Quartic formula: https://upload.wikimedia.org/wikipedia/commons/9/99/Quartic_Formula.svg I'm a math teacher and I would like to show my students exact answers of these polynomials rather than just decimal approximations. Thanks. RE: Cubic and Quartic Formulae - LCieParagon - 08-06-2015 05:42 AM Quite clearly you can see what I mean when I type: solve(x^3+x+1=0,x) You receive a decimal value approximately -0.68... However, there is obviously an exact solution given that it is a cubic polynomial. You can find this on wolfram alpha at: http://www.wolframalpha.com/input/?i=solve%28x^3%2Bx%2B1%3D0%2Cx%29 I never understood why calculators with this capability gave approximate answers as opposed to exact. I mean when computing (-1)^(1/3), you get the principal complex root as opposed to -1. I'm sure the ability is there to put this feature in. Maple does it flawlessly. RE: Cubic and Quartic Formulae - Manolo Sobrino - 08-06-2015 09:01 AM There are a few reasons. Check again the closed-form solutions. You want 3 or 4 several line expressions with nested radicals as answers on a calculator screen. That's not very useful, besides it would only look nice (not really) for integer or rational coefficients. That's the same reason why closed form eigenvalues are either trivial or you don't really want to see them. And then, in the numerical world people don't use (or shouldn't be using) those expressions as they are numerically unstable. There are quite a few much better methods. The interesting part about them is that they do exist and they are algebraic expressions, yet the quintic doesn't have one of this kind (Abel-Ruffini theorem). I guess you won't be using calculators to introduce Galois theory. TI have actually given details on the nifty algorithm they used in their numerical polynomial root finder, which appeared first on the TI 85: ftp://ftp.ti.com/pub/graph-ti/calc-apps/info/polyroot.txt Taking into account the constraints of the machine it was designed for and its intended use, all of this makes sense to me. RE: Cubic and Quartic Formulae - Gerald H - 08-06-2015 09:07 AM But note this: http://www.hpcalc.org/search.php?query=galois RE: Cubic and Quartic Formulae - Manolo Sobrino - 08-06-2015 09:20 AM (08-06-2015 09:07 AM)Gerald H Wrote: But note this: And now I have to take that remark back... The things people do for their calculators (obviating the existence of computers and the ephemeral quality of life) never cease to amaze me. RE: Cubic and Quartic Formulae - parisse - 08-06-2015 12:01 PM If you are showing exact formula for 3rd or 4th order equations to your students, you should really emphasize that they should in fact never be used. Numerically, it's much more precise to run iteratives methods to find root approximations. Symbolically, it's way more efficient to use algebraic extensions of Q (rootof in Xcas, unfortunately not available to the user on the Prime, not my choice...). Xcas has a small user program (comments are in French) to demonstrate Cardan formula that should be easy to adapt to the Prime Code:
RE: Cubic and Quartic Formulae - LCieParagon - 08-06-2015 01:42 PM (08-06-2015 09:01 AM)Manolo Sobrino Wrote: There are a few reasons. Check again the closed-form solutions. You want 3 or 4 several line expressions with nested radicals as answers on a calculator screen. That's not very useful, besides it would only look nice (not really) for integer or rational coefficients. That's the same reason why closed form eigenvalues are either trivial or you don't really want to see them. Actually, I do introduce calculators when speaking about Galois Theory. I teach differential equations, Calculus 3, Calculus 2, and Pre-Calculus. I explain that there are certain forms of quintics (and higher degrees) that can be solved numerically. I have a chart in my classroom regarding this. Additionally, parisse noted that it's more practical to use approximations. I disagree with this. It's in fact a portion of the Ti-nSpire CAS (and the TI-89 for that matter) I prefer to the HP Prime. For instance (if we are talking about degrees), one can find sin(36), sin (18), sin(54), and sin(72) exactly. This angles are incredibly useful for architecture or engineering. One can apply half-angle, addition/subtraction, and double angle formulae to receive every whole number degree divisible by 3. But it gets better. One can find the numerical value of sin(1) by applying the cubic formula. One can solve equations like sin(3x) = 3sin(x) - 4sin^3(x) by letting x = 1 and find the exact answers. Additionally, if decide to take logarithms of these numbers (like sin(1) because logarithms of numbers close to 0+ diverge to -inf), we will see that our error will be huge if we use approximations. If we use exact answers (by simply using the copy/paste commands), our answers will be significantly more accurate, if not exact. RE: Cubic and Quartic Formulae - Tim Wessman - 08-06-2015 07:19 PM Very interesting! Thanks for the comments. (08-06-2015 01:42 PM)LCieParagon Wrote: For instance (if we are talking about degrees), one can find sin(36), sin (18), sin(54), and sin(72) exactly. This angles are incredibly useful for architecture or engineering. One can apply half-angle, addition/subtraction, and double angle formulae to receive every whole number degree divisible by 3. If I am remembering my math from ages ago correctly, you can always find an exact angle if you go out far enough... how would you decide at which point it is useful to find an exact angle or not? Would something like this be implemented by generating a collection of "interesting" values of finer and finer resolution until you were happy with the capability? Speaking of the nspire, why would doing something like sin(73) in degrees helpfully convert it to "cos(17)"? Simply moving to a smaller angle in the trig function, or is that a common thing? RE: Cubic and Quartic Formulae - parisse - 08-07-2015 06:08 AM (08-06-2015 01:42 PM)LCieParagon Wrote: Additionally, parisse noted that it's more practical to use approximations. I disagree with this. It's in fact a portion of the Ti-nSpire CAS (and the TI-89 for that matter) I prefer to the HP Prime. For instance (if we are talking about degrees), one can find sin(36), sin (18), sin(54), and sin(72) exactly. This angles are incredibly useful for architecture or engineering. One can apply half-angle, addition/subtraction, and double angle formulae to receive every whole number degree divisible by 3.You misunderstood what I wrote. I did not say it's more practical to use approximations than exact formula. I said that for *both* numerical and symbolic computations, it's very inefficient to use Cardan or Ferrari formula. For numerical, because the expressions are huge and will introduce a lot of rounding errors instead of just one or two with an interative method. For symbolics, it's much much more efficient to work in Q[X]/M[X] where Q[X] is polynomial over the rationals and M is the minimal (irreducible) polynomial of an algebraic number than to work with embedded square roots, cubic roots, etc. RE: Cubic and Quartic Formulae - Manolo Sobrino - 08-07-2015 10:39 AM Did you really try that or it's just guessing? It's a dead end. Putting aside the fact that the whole endeavour is a bit futile, the root of the equation that gives you the value of sin(1°) (I don't understand what makes Pi/180 so appealing) has cube roots of a complex number with parts made up of square roots of sums of square roots of some integers. Unfortunately, the "full Reals" Cardan root is not the good one. How do you get a standard pretty closed form for that without the closed forms of values of trigonometric functions with very ugly arguments... that you don't have? Well, you could just write it down and so be it. After some cranking, a form happens to be: \begin{equation} sin\left(1°\right)=\frac{2 \sqrt[3]{2} \left(-1+i \sqrt{3}\right)-\left(1+i \sqrt{3}\right) \left(-\sqrt{8-\sqrt{3}-\sqrt{15}-\sqrt{10-2 \sqrt{5}}}+i \sqrt{8+\sqrt{3}+\sqrt{15}+\sqrt{10-2 \sqrt{5}}}\right)^{2/3}}{4\ 2^{2/3} \sqrt[3]{-\sqrt{8-\sqrt{3}-\sqrt{15}-\sqrt{10-2 \sqrt{5}}}+i \sqrt{8+\sqrt{3}+\sqrt{15}+\sqrt{10-2 \sqrt{5}}}}} \end{equation} I can't resist the version with prettier numbers: \begin{equation} sin\left(1°\right)=\frac{-2+2 i \sqrt{3}-\left(1+i \sqrt{3}\right) \left(-\sqrt{4-\sqrt{7+\sqrt{5}+\sqrt{6 \left(5+\sqrt{5}\right)}}}+i \sqrt{4+\sqrt{7+\sqrt{5}+\sqrt{6 \left(5+\sqrt{5}\right)}}}\right)^{2/3}}{4 \sqrt{2} \sqrt[3]{-\sqrt{4-\sqrt{7+\sqrt{5}+\sqrt{6 \left(5+\sqrt{5}\right)}}}+i \sqrt{4+\sqrt{7+\sqrt{5}+\sqrt{6 \left(5+\sqrt{5}\right)}}}}} \end{equation} (Mathematica principal roots.) Yes, the imaginary part is zero. It is a closed form, but can we compute with just easy radicals of real numbers? No. What did we improve? Nothing. Of course, with such a closed expression for sin(1°) there are equally computationally inefficient straightforward ways to get such closed expressions for every degree. Those things might look lovely, but what's the point? (No Tim, selling calculators is not a valid point . I'm staying out of the Nspire thing so I don't really get the gist of your question.) When Bernard talks about Algebra (and Maths in general) I always take notes. This is a great forum, not only about calculators. Sometimes the mood is a bit too upfront if you're not used to it, but you know these issues are so highly controversial... (edit - fixed some behaviour of the Mathematica TeX parser... Using the roots of i, there are shorter ones indeed: \begin{equation} sin\left(1°\right)=\frac{1}{4} (-1)^{59/180} \left(i-2 (-1)^{8/45}+\sqrt{3}\right) \end{equation} Eventually you'd get the trivial WAlpha expressions that come straight from the definition of sin (1°) in terms of complex exponentials. \begin{equation} sin\left(1°\right)=-\frac{1}{2} (-1)^{89/180} \left(\sqrt[90]{-1}-1\right) \end{equation} RE: Cubic and Quartic Formulae - LCieParagon - 08-08-2015 02:37 AM (08-06-2015 07:19 PM)Tim Wessman Wrote: Very interesting! Thanks for the comments. You are both correct and incorrect at the same time. You can never get to sin(1) this way. You can get to sin (3/2) by utilizing the half-angle formula. sin(1) is to be calculated using the cubic formula. At first glance, it would seem that sin(1) has an imaginary component, but the imaginary part is exactly 0. Additionally, you wrote sin(73) which does in fact = cos(17). It really just depends on which you prefer. Once again there is an exact answer to this. It's not pretty, and must be calculated using the cubic formula. RE: Cubic and Quartic Formulae - LCieParagon - 08-08-2015 02:44 AM (08-07-2015 10:39 AM)Manolo Sobrino Wrote: Did you really try that or it's just guessing? It's a dead end... If you solve: sin(3x) = 3sin(x) - 4sin^3(x) by letting x = 1, you can find the value of sin(1) which you listed above. Like I said, Maple computes this value flawlessly. I don't see why a calculator can't do the same. This calculator has more than the capabilities of doing so. I've also noticed approximations with certain products and sums that one can derive from using residues from complex analysis. For instance, Our HP Prime has no ability to compute such things. I use residues frequently in my graduate studies. RE: Cubic and Quartic Formulae - parisse - 08-08-2015 06:20 AM Xcas and the Prime can compute sum(1/(a^2+n^2),n,0,inf), just try! I will just not implement Cardan/Ferrari formula in the giac kernel because they are useless as explained earlier, you are of course free to adapt my Xcas program for 3rd order equation if you really want Cardan formula on the Prime. RE: Cubic and Quartic Formulae - Thomas Klemm - 08-15-2015 10:05 AM (08-06-2015 01:42 PM)LCieParagon Wrote: One can find the numerical value of sin(1) by applying the cubic formula. One can solve equations like sin(3x) = 3sin(x) - 4sin^3(x) by letting x = 1 and find the exact answers. Did you ever consider to use this formula to solve a cubic equation using trigonometry? Cheers Thomas |