Post Reply 
Ln of a complex number
03-02-2024, 02:00 PM
Post: #4
RE: Ln of a complex number
(03-02-2024 09:30 AM)hp-zl Wrote:  In fact, TI-Nspire is smarter here.
I was unable to get this result on HP-Prime:
TI-NSpire
DelVar a,b,c
solve(x^3+a*x^2+b*x+c=0,x)

I am not so sure getting exact solution to cubic is that useful.
It is likely you just get back a big mess, and just use approx roots.
Due to cancellations, approx roots may be worse than solved with proot.

Perhaps it is smarter not even try, but if you need this, here it is.

(09-08-2023 02:26 PM)Albert Chan Wrote:  This program solve x^3 = a*x + b, for x

Code:
cubic_ab(a,b) := 
BEGIN
LOCAL d;
a, b := a/3, b/2;    /* x^3 = (3a)*x + (2b) */
d := sqrt(b^2-a^3) * (-1)^(sign(re(b))==-1);
b := surd(b+d, 3);
return [a/b, b];     /* alpha, beta */
END;
Code:
cubic(a,b) :=
BEGIN
LOCAL w := exp(2*pi/3*i);
[[1,1],[w,conj(w)],[conj(w),w]] * cubic_ab(a,b);
END;

Cas> f := x^3+a*x^2+b*x+c
Cas> g := -f(x=x-a/3);                                // = -x^3 + A*x + B
Cas> r := cubic(g'(x=0), g(x=0)) .- a/3;       // solution for f roots

I am not posting the result (you can try this, it is 1k characters long!) (*)
Warning: do not simplify this, or HP Prime may get stuck in infinite loops.

Just to confirm:

Cas> r(a=2., b=3., c=4.)
[−1.65062919144,−0.17468540428-1.54686888723*i,−0.17468540428+1.54686888723*i]

Cas> proot(f(a=2., b=3., c=4.))
[−1.65062919144,−0.17468540428-1.54686888723*i,−0.17468540428+1.54686888723*i]

(*) to reduce mess, it may be better to get (α,β) from cubic_ab(a,b) first.
Bonus, it may be possible to simplify (α,β), without getting stuck.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Ln of a complex number - Quadratica - 03-01-2024, 10:12 PM
RE: Ln of a complex number - hp-zl - 03-02-2024, 09:30 AM
RE: Ln of a complex number - Albert Chan - 03-02-2024, 12:56 PM
RE: Ln of a complex number - Albert Chan - 03-02-2024 02:00 PM
RE: Ln of a complex number - Quadratica - 03-02-2024, 09:50 PM
RE: Ln of a complex number - johnb - 03-03-2024, 07:01 PM
RE: Ln of a complex number - Albert Chan - 03-03-2024, 08:23 PM
RE: Ln of a complex number - Albert Chan - 03-03-2024, 10:48 PM



User(s) browsing this thread: 1 Guest(s)