The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

Solving a cubic equation using trigonometry, but with a2 term?
Message #1 Posted by snaggs on 29 Sept 2011, 1:44 a.m.

Hi,

I read and entered this program here, after finding his Quadratic solver using ACOSH nice to use.

"Solving a cubic equation using trigonometry" by Thomas Klemm
http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv020.cgi?read=180771

A general cubic equation can be transformed to the following form using a substitution;


 00 { 31-Byte Prgm }           00 { 34-Byte Prgm }
 01>LBL "CuEq"                 01>LBL "CuEqH"
 02 2                          02 2
 03 /                          03 /
 04 X<>Y                       04 X<>Y
 05 -3                         05 3
 06 /                          06 /
 07 /                          07 /
 08 LASTX                      08 LASTX
 09 SQRT                       09 SQRT
 10 /                          10 /
 11 LASTX                      11 LASTX
 12 X<>Y                       12 X<>Y
 13 ASIN                       13 ASINH
 14 3                          14 3
 15 /                          15 /
 16 SIN                        16 SINH
 17 *                          17 *
 18 2                          18 -2
 19 *                          19 *
 20 END                        20 END

However, it doesn't work if you have an a2 term, unless I've made a typo. Having to do substitution before using the program seems to defeat the purpose.

Daniel.
      
Re: Solving a cubic equation using trigonometry, but with a2 term?
Message #2 Posted by Dieter on 29 Sept 2011, 7:19 a.m.,
in response to message #1 by snaggs

Sure there is no a2 term: That's why it says "A general cubic equation can be transformed to the following form using a substitution". ;-) For more details see below.

There are well-known standard methods for solving cubic equations. Just take a look at de.wikipedia.org - as well as the last link ("Leitfaden") on that page for a step-by-step solution. The entry on en.wikipedia.org is has some more details on the numerics.

Having read all this you may finally proceed to the actual algorithm. ;-) For instance by using Cardano's method as described on de.wikipedia.org. This is the method you will probably use.

Edit 1: Oops, I was a bit too fast. ;-) I didn't notice you're not Thomas so you probably don't read German. However, the mentioned Cardano method first reduces the cubic equation to a simplified form without "a2 term" and then this reduced equation is solved. The latter part is already done by the program you got. So you just have to provide the initial reduction (or transformation, as Thomas said) the way it is described in the wikipedia articles. The rest is already there.

Edit 2: All this has already been discussed in the thread you mentioned. Please read messages 3 - 5 there. ;-)

Dieter

Edited: 29 Sept 2011, 8:49 a.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall