achrzesz wrote :
sage: s=solve(3*x^3-9*x+10,x,solution_dict=True)
sage: ns=[n(s[k][x]) for k in range(3)]
sage: ns
[1.06780542232902 - 1.84949324407141*I, 0.0277635108030695 +
1.24902476648341*I, -1.09556893313209 +
0.600468477588001*I] # no real solution, no conjugate
solutions
sage: x=CC[x].0
sage: p=3*x^3-9*x+10
sage: p.roots(multiplicities=False)
[-2.13561084465804, 1.06780542232902 - 0.648556288895405*I,
1.06780542232902 + 0.648556288895405*I]
Andrzej Chrzeszczyk
There is a curious effect about (-1)^(1/3).
One says : x^(1/3) in RR is the only third radix (if x in RR)
So (-1)^(1/3) == -1.
It's right in RR... but there is no sure way to test if an expression is
in RR.
So maxima doesn't change (-1)^(1/3) to -1 because it can't change
(7-5*sqrt(2))^(1/3) to 1-sqrt(2).
One other defines z^u to exp(u*log(z)) and log(z) == r*exp(i*a)
with r == abs(z) and a == arg (z) == arctan2 (imaginary(z), real(z)) in
]-pi, pi]
So -1 == exp(i*pi), log(-1) == I*pi and (-1)^(1/3) == exp(i*pi/3)
sage: (-1)^(1/3).n() # returns 0.50000 + 0.86602*I
But if you replace (-1)^(1/3) by -1 in this symbolic ring and the result
is right.
sage: res=solve (3*x^3-9*x+10,x)
sage: res2 = map (lambda eq:eq.rhs(), res)
sage: res3 = map (lambda z:z.substitute_expression((-1)^(1/3)==-1), res2)
sage: map (lambda z:z.n(),
res2) # is wrong
[1.06780542232902 - 1.84949324407141*I,
0.0277635108030695 + 1.24902476648341*I,
-1.09556893313209 + 0.600468477588001*I]
sage: map (lambda z:z.n(),
res3) # is right
[1.06780542232902 - 0.648556288895405*I,
1.06780542232902 + 0.648556288895405*I,
-2.13561084465804]
F. from France.
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org