Ask Your Question
1

Multiplicities of solutions not showing up correctly

asked 2015-12-08 23:49:34 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I am trying to find the roots of the following

f = -54.0*I*x**27 + (-202.5 - 584.567147554496*I)*x**15 + (1.62379763209582 + 2.0625*I)*x**3

using the command

sols, mults = solve(f ,x, multiplicities=True)

but the answer I get is wrong, because there should be 27 roots, of which x=0.0 should have multiplicity 3 and all the other should have multiplicity 1. This is what I get instead:

([x == 1/4*2^(3/4)*(sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + I*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/4*2^(3/4)*(I*sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + (-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/2*I*2^(3/4)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12), x == 1/4*2^(3/4)*(I*sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) - (-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == -1/4*2^(3/4)*(sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) - I*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == -1/2*2^(3/4)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12), x == -1/4*2^(3/4)*(sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + I*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/4*2^(3/4)*(-I*sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) - (-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == -1/2*I*2^(3/4)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12), x == 1/4*2^(3/4)*(-I*sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + (-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/4*2^(3/4)*(sqrt(3)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) - I*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/2*2^(3/4)*(-1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12), x == 1/4*2^(3/4)*(sqrt(3)*(1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + I*(1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12)), x == 1/4*2^(3/4)*(I*sqrt(3)*(1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I - 189750626/4382103)^(1/12) + (1/30773305171191*I*sqrt(1232006789381660639610346922212*I - 1564858793284486386236895596057) + 15*I ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-12-09 17:33:21 +0100

slelievre gravatar image

You should work in a polynomial ring rather than in the symbolic ring.

sage: f = -54.0*I*x**27 + (-202.5 - 584.567147554496*I)*x**15 + (1.62379763209582 + 2.0625*I)*x**3
sage: R.<x> = PolynomialRing(CDF)
sage: ff = R(f)
sage: ff
-54.0*I*x^27 + (-202.5 - 584.567147554496*I)*x^15 + (1.62379763209582 + 2.0625*I)*x^3
sage: ff.roots()
[(0.0, 3),
 (-1.1919725914270978 - 0.2841390355028779*I, 1),
 (-1.1743480625420717 + 0.34991467276124905*I, 1),
 (-0.8902090270391978 - 0.8420579186658488*I, 1),
 (-0.8420579186658474 + 0.8902090270391964*I, 1),
 (-0.6340537082641279 + 0.017624528885021636*I, 1),
 (-0.5579188831629703 - 0.3017635643879005*I, 1),
 (-0.5402943542779494 + 0.33229014387622624*I, 1),
 (-0.349914672761249 - 1.1743480625420724*I, 1),
 (-0.33229014387622624 - 0.5402943542779503*I, 1),
 (-0.30176356438790186 + 0.5579188831629743*I, 1),
 (-0.2841390355028765 + 1.1919725914270942*I, 1),
 (-0.017624528885021612 - 0.6340537082641236*I, 1),
 (0.01762452888502454 + 0.6340537082641229*I, 1),
 (0.2841390355028755 - 1.1919725914270927*I, 1),
 (0.3017635643878972 - 0.5579188831629707*I, 1),
 (0.33229014387622324 + 0.5402943542779469*I, 1),
 (0.3499146727612491 + 1.1743480625420757*I, 1),
 (0.5402943542779478 - 0.332290143876229*I, 1),
 (0.5579188831629693 + 0.3017635643879034*I, 1),
 (0.6340537082641288 - 0.017624528885022077*I, 1),
 (0.8420579186658496 - 0.8902090270392002*I, 1),
 (0.8902090270391977 + 0.8420579186658482*I, 1),
 (1.174348062542071 - 0.34991467276124827*I, 1),
 (1.1919725914270973 + 0.28413903550287867*I, 1)]
edit flag offensive delete link more

Comments

Thanks a lot!

physicist gravatar imagephysicist ( 2015-12-09 23:14:33 +0100 )edit
1

answered 2015-12-09 17:24:41 +0100

tmonteil gravatar image

The solve() function is not very reliable, since your symbolic expression is actually a polynomial with complex floating-point numbers, you should try to solve it as a polynomial in coefficients in the complex double field:

sage: f.roots(ring=CDF,multiplicities=True)
[(0.0, 3),
 (-1.191972591427096 - 0.28413903550287783*I, 1),
 (-1.1743480625420737 + 0.3499146727612495*I, 1),
 (-0.890209027039199 - 0.8420579186658486*I, 1),
 (-0.8420579186658483 + 0.8902090270391965*I, 1),
 (-0.6340537082641291 + 0.01762452888502273*I, 1),
 (-0.5579188831629702 - 0.3017635643879002*I, 1),
 (-0.5402943542779471 + 0.3322901438762252*I, 1),
 (-0.3499146727612478 - 1.174348062542074*I, 1),
 (-0.33229014387622674 - 0.5402943542779496*I, 1),
 (-0.30176356438790053 + 0.5579188831629717*I, 1),
 (-0.2841390355028776 + 1.1919725914270973*I, 1),
 (-0.01762452888502295 - 0.6340537082641262*I, 1),
 (0.017624528885023357 + 0.6340537082641253*I, 1),
 (0.2841390355028785 - 1.1919725914270978*I, 1),
 (0.3017635643879007 - 0.5579188831629712*I, 1),
 (0.33229014387622596 + 0.5402943542779489*I, 1),
 (0.34991467276124755 + 1.1743480625420706*I, 1),
 (0.5402943542779484 - 0.33229014387622385*I, 1),
 (0.5579188831629713 + 0.30176356438789853*I, 1),
 (0.6340537082641249 - 0.017624528885023315*I, 1),
 (0.8420579186658516 - 0.8902090270392002*I, 1),
 (0.8902090270391929 + 0.8420579186658462*I, 1),
 (1.1743480625420755 - 0.34991467276124694*I, 1),
 (1.1919725914271002 + 0.28413903550287595*I, 1)]
edit flag offensive delete link more

Comments

Thanks a lot!

physicist gravatar imagephysicist ( 2015-12-09 23:13:29 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-12-08 23:49:34 +0100

Seen: 597 times

Last updated: Dec 09 '15