cubic solver
|
09-08-2023, 02:26 PM
(This post was last modified: 03-03-2024 11:58 PM by Albert Chan.)
Post: #1
|
|||
|
|||
cubic solver
This program solve x^3 = a*x + b, for x
Code: cubic_ab(a,b) := Code: cubic(a,b) := Michael Penn's example Let x = sin(θ) + cos(θ), it reduced to cubic: x^3 = 3*x - 11/8 Cas> r := cubic(3, -11/8) Cas> simplify(r) → [1/2, (3*√5-1)/4, (-3*√5-1)/4] Cas> float(Ans) → [0.5, 1.42705098312, −1.92705098312] Cas> float(r) → [1.42705098312, −1.92705098312, 0.5] We have Cas simplify bug here! symbolic and approximate numbers don't match. Luckily, the algorithm doesn't care which cube roots is used (no need for principle root). But, this bug should be fixed. Cas> b := cubic_ab(3, -11/8) [2] → (1/256*(-√15*48*i-176))^(1/3) Cas> polar(float(b)) → 1., −0.77627903074 Cas> polar(simplify(b)) → 1 , atan(√15) Simplify bug had phase angle off by 2*pi/3: Cas> atan(√15) - 2*pi/3.0 → −0.77627903074 Update: cubic_ab(a,b) code explained here |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
cubic solver - Albert Chan - 09-08-2023 02:26 PM
RE: cubic solver - Albert Chan - 09-08-2023, 02:44 PM
RE: cubic solver - parisse - 09-08-2023, 06:56 PM
RE: cubic solver - Albert Chan - 06-29-2024, 02:46 PM
RE: cubic solver - Albert Chan - 06-29-2024, 03:29 PM
RE: cubic solver - Albert Chan - 07-02-2024, 02:34 PM
RE: cubic solver - Albert Chan - 07-02-2024, 05:12 PM
RE: cubic solver - Albert Chan - 07-03-2024, 10:17 PM
RE: cubic solver - Albert Chan - 07-03-2024, 11:48 PM
Quarter Solver - Albert Chan - 07-04-2024, 08:37 PM
|
User(s) browsing this thread: 6 Guest(s)