Open rtoy opened 2 months ago
Imported from SourceForge on 2024-07-01 18:06:30 Created by baccala on 2017-06-21 12:34:29 Original: https://sourceforge.net/p/maxima/bugs/3312/#c8fc
I've found that the roots can be simplified by applying radcan to them. Also, running these commands:
radcan(subst(roots[1], eq)); radcan(subst(roots[2], eq)); radcan(subst(roots[3], eq));
shows that the roots returned by solve() actually do solve the equation.
But the multiplicities returned by solve() still aren't right. Applying radcan() to roots shows that two of them are actually identical.
Should solve() use radcan() on its solutions before returning them?
Imported from SourceForge on 2024-07-01 18:06:32 Created by baccala on 2017-06-22 18:03:19 Original: https://sourceforge.net/p/maxima/bugs/3312/#9d7f
Here's a cubic that doesn't solve() right, even with radcan():
eq : y^3 + 3y - 2%i; radcan(solve(eq));
Maxima branch_5_40_base_61_g09d6e16 gives me 1/(-1)^(1/6) and -2/(-1)^(1/6).
Wolfram Alpha reports that the roots are i and -2i, since the polynomial factors as (y-i)^2 (y+2i).
Imported from SourceForge on 2024-07-01 18:06:35 Created by kjak on 2017-06-22 19:12:46 Original: https://sourceforge.net/p/maxima/bugs/3312/#0c19
I haven't checked anything by hand, or even looked at these very closely, but it looks like Maxima can solve these and substitute back in to get 0 without radcan.
Original example (now just using domain:complex
):
(%i1) domain : complex$
(%i2) g: (-27/4)^(1/7)$
(%i3) eq: subst(x=g, y^3 + x^3*y +x)$
(%i4) roots: solve(eq)$
(%i5) map (lambda ([e], ratsimp (subst (e, eq))), roots);
(%o5) [0,0,0]
Second example (now just using rectform):
(%i1) rectform (solve (y^3 + 3*y - 2*%i));
(%o1) [y = -2*%i,y = %i,y = %i]
Imported from SourceForge on 2024-07-01 18:06:37 Created by baccala on 2017-06-22 20:43:49 Original: https://sourceforge.net/p/maxima/bugs/3312/#c25a
Yeah, I see that rectform() cleans up those answers nicely.
Imported from SourceForge on 2024-07-01 18:06:39 Created by kjak on 2017-06-29 22:58:53 Original: https://sourceforge.net/p/maxima/bugs/3312/#f8af
Imported from SourceForge on 2024-07-01 18:06:41 Created by kjak on 2017-06-29 22:58:54 Original: https://sourceforge.net/p/maxima/bugs/3312/#fa75
Since solve
actually can solve these, I'm closing this as wont-fix.
Imported from SourceForge on 2024-07-01 18:06:43 Created by baccala on 2017-06-29 23:14:11 Original: https://sourceforge.net/p/maxima/bugs/3312/#60f6
It definitely doesn't get the multiplicities right.
Imported from SourceForge on 2024-07-01 18:06:45 Created by kjak on 2017-06-30 00:00:44 Original: https://sourceforge.net/p/maxima/bugs/3312/#c159
Imported from SourceForge on 2024-07-01 18:06:47 Created by kjak on 2017-06-30 00:00:44 Original: https://sourceforge.net/p/maxima/bugs/3312/#ed24
Hmm.. OK, I'll reopen this with a different title since we already have examples here. solve
does actually solve the equations, but it doesn't identify the multiplicities correctly.
Thanks.
Imported from SourceForge on 2024-07-01 18:06:49 Created by baccala on 2017-07-04 17:10:33 Original: https://sourceforge.net/p/maxima/bugs/3312/#a32e
Here's another example of an equation that produces roots that I can't simplify properly:
cis(theta) := %i*sin(theta) + cos(theta);
eq: y^4 - 4*y + 3*cis(2*%pi/3);
roots: solve(eq);
zero: rhs(roots[2]-roots[3]);
Now, float(rectform(zero))
shows that zero
is, in fact, zero, but I can't find any Maxima combination that can simplify it to 0
.
I haven't looked at the solve()
code to see how it computes multiplicities, but I suspect that an inability to simplify things to zero lies at the heart of this problem.
Imported from SourceForge on 2024-07-01 18:06:29 Created by baccala on 2017-06-20 23:30:38 Original: https://sourceforge.net/p/maxima/bugs/3312
Here's a cubic equation involving radical cofficients that solve() doesn't handle correctly:
g: (-27/4)^(1/7); eq: subst(x=g, y^3 + x^3*y +x); roots: solve(eq);
The 'roots' do not solve the equation:
ratsimp(subst(roots[1], eq)); ratsimp(subst(roots[2], eq)); ratsimp(subst(roots[3], eq));
Here are the actual roots:
ratsimp(subst(y=-3/(2*g^2), eq)); ratsimp(subst(y=3/g^2, eq));
There are only two of them (the first one has multiplicity two)