Ln of a complex number
|
03-01-2024, 10:12 PM
(This post was last modified: 03-01-2024 10:14 PM by Quadratica.)
Post: #1
|
|||
|
|||
Ln of a complex number
1.How can I get the Prime to give me an exact value for Ln(1+i) and then Ln(a+ib) a, b are real and i is the root of negative 1. (My nspire does this)
2. How can I get the Prime to return a symbolic solution to the general cubic, it does the quadratic. (you've guessed it, my nspire does the cubic too) I prefer the Prime over the nspire ! Many thanks for helping. |
|||
03-02-2024, 09:30 AM
(This post was last modified: 03-02-2024 09:42 AM by hp-zl.)
Post: #2
|
|||
|
|||
RE: Ln of a complex number
HP-Prime:
purge(a,b,c) Ad. 1. You have to approach it a little differently. Enter (CAS Mode): re(ln(1+i)) and im(ln(1+i)) Similarly: re(ln(a+i*b)), im(ln(a+i*b)) Ad.2. 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) HP-Prime (CAS Mode) in a similar command gives the result: [[]] Regards. |
|||
03-02-2024, 12:56 PM
Post: #3
|
|||
|
|||
RE: Ln of a complex number
(03-02-2024 09:30 AM)hp-zl Wrote: re(ln(a+i*b)), im(ln(a+i*b)) Cas> parts(z) := [re(z), im(z)] Cas> m := parts(ln(z)); // setting with complex off [ln(abs(z)), 1/2*π*(-sign(z)+1)] Cas> m(z=e), m(z=-e), m(z=0) [1,0], [1,π], [-∞, 1/2*π] Except for weird phase angle for ln(0), this looks OK Cas> m := parts(ln(z)); // setting with complex on [ln(abs(z)), π*sign(im(z)) + atan(im(z)/re(z))] // ? HP Prime has a bug on imag part, using atan instead of atan2 Correct ln(z) imag part should be arg(z) = atan2(im(z), re(z)) Above is only correct for re(z) < 0 Cas> m(z=1+i) [1/2*ln(2), 5/4*π] // ? |
|||
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 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 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. |
|||
03-02-2024, 09:50 PM
Post: #5
|
|||
|
|||
RE: Ln of a complex number
Thanks hp-zl and Chan for those replies.
The Ln (a+i*b) works as you suggested and I am very pleased about this one as I use complex logs a great deal. The cubic is not a big issue and as pointed out its exact solution is too messy to be of any real use. The more I learn about the Prime the more I like it and it suits the kind of mathematics I need it for. It really is a welcome change after 12 years of the nspire. |
|||
03-03-2024, 07:01 PM
(This post was last modified: 03-03-2024 07:02 PM by johnb.)
Post: #6
|
|||
|
|||
RE: Ln of a complex number
(03-02-2024 09:50 PM)Quadratica Wrote: Thanks hp-zl and Chan for those replies. I have to say, we are really quite blessed as a group to have mathematicians of Albert Chan's caliber. Albert, quite often, I really have to re-read your posts multiple times until my head hurts, or go dig out the math books and spend an enjoyable lunch break (or longer) before I really understand... but quite honestly, I've needed a friend/colleague like this for probably my entire career! Daily drivers: 15c, 32sII, 35s, 41cx, 48g, WP 34s/31s. Favorite: 16c. Latest: 15ce, 48s, 50g. Gateway drug: 28s found in yard sale ~2009. |
|||
03-03-2024, 08:23 PM
Post: #7
|
|||
|
|||
RE: Ln of a complex number
(03-03-2024 07:01 PM)johnb Wrote: Albert, quite often, I really have to re-read your posts multiple times until my head hurts, or go dig out the math books and spend an enjoyable lunch break (or longer) before I really understand... but quite honestly, I've needed a friend/colleague like this for probably my entire career! Thanks! I am not a mathematician, just learning as I go. Solving a cubic is really solving a quadratic. see https://www.hpmuseum.org/forum/thread-10...#pid150296 BTW, I don't like this form: https://www.quantamagazine.org/the-scand...-20220630/ This may fail if we pick the wrong cube root (principle cube root may not work) Also, it is inefficient, required evaluations of 2 different cube roots. Also, it is inaccurate, 1 cube root may be hit with huge cancellation errors. Thus, cubic_ab(a,b) only evaluate 1 cube root. Now the issue of picking wrong cube root is gone. cubic_ab(a,b) → (α=(a/3)/β, β) → αβ = a/3, guaranteed x³ = (a*x+b) → x = [α+β, α*ω+β/ω, α/ω+β*ω] Cas> r := cubic_ab(15.,4.) → [2-i, 2+i] Cas> product(r) → 5. Cas> sum(r) → 4. // one root of cubic: x^3 = 15x + 4 |
|||
03-03-2024, 10:48 PM
Post: #8
|
|||
|
|||
RE: Ln of a complex number
(03-03-2024 08:23 PM)Albert Chan Wrote: Solving a cubic is really solving a quadratic. Perhaps it is easier to understand if we matched cubic_ab(a,b) code. Starting from identity, with ω = cis(2*pi/3) x³ - 3αβx - (α³+β³) = (x-(α+β)) * (x-(αω+β/ω)) * (x-(α/ω+βω)) LHS is a depressed cubic: x³ - a*x - b , where a = 3αβ, b = (α³+β³) We setup a quadratic of t, with roots (α³, β³) (t - α³)*(t - β³) = t² - b*t + (a/3)³ = 0 t = b/2 ± √Δ, where Δ = (b/2)² - (a/3)³ β = ³√t α = (a/3) / β x³ = a*x + b → x = [(α+β), (αω+β/ω), (α/ω+βω)] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)