A while ago I've posted a program that uses ACOSH to solve a quadratic equation:
Short Quadratic Solver (HP-42S) Message #29
Recently I stumbled across a way to solve a cubic equation using trigonometry. Some of you might find that interesting as well.
Cheers
Thomas
Equations
A general cubic equation can be transformed to the following form using a substitution:
The trick is to use the following identity:
Here we set:
With the following substitution we can get a closed-form solution:
A similar formula can be found using the following identity:
Programs
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
Examples
x3 + 6x - 2 = 0
CuEq: 3.27480002074E-1 i0
CuEqH: 3.27480002074E-1
x3 + 3x - 4 = 0
CuEq: 1 i0
CuEqH: 1
References
Edited: 22 Mar 2011, 12:51 p.m. after one or more responses were posted