> > [...,..,x == (-1)^(1/3)*3^(1/3)]
> >
> >
> > I ran into this issue while demonstrating the usefulness of the solve
> > function in front of a class of students. That was quite 'fun' :-)
> >
> > Ted
> >
> It does seem strange that the answer that looked like it should be real is
> actually not. If you have sage evaluate the first value in the returned
> answers you see that despite its appearance it is the pure real number that
> you desire.
>
> b[0].right().n()
>
> you get
>
> -1.44224957030741
>
> So make sure that your students see that sage *did* return the desired
> value. But also remind them to be careful because all other things
> being equal technology tends to answer your questions in the way that
> makes the most sense to its programmer, which does not necessarily
> make the most sense to a student (or anyone else).
right, as Jacob pointed it out, one has to be careful about values that look
real (resp. complex) and are not. In fact this is a very nice example to show
students that they should take care about the appearance of symbolic objects
(and the difference between classes where you have a canonical form like
integers, and other classes where no canonical form exists, more precisely
the problem is undecidable):
You can construct other nice examples: take the equation (x-1)*(x^2+1)=0,
with trivial root 1:
sage: expand((x-1)*(x^2+1))
x^3 - x^2 + x - 1
Then replace the constant term by a symbolic value a, and solve for the
degree 3 equation:
sage: var('a'); sol = solve(x^3 - x^2 + x - a==0, x); sol
a
[x == (-sqrt(3)*I/2 - 1/2)*(sqrt(27*a^2 - 14*a + 3)/(6*sqrt(3)) + (27*a -
7)/54)^(1/3) - 2*(sqrt(3)*I/2 - 1/2)/(9*(sqrt(27*a^2 - 14*a + 3)/(6*sqrt(3)) +
(27*a - 7)/54)^(1/3)) + 1/3, x == (sqrt(3)*I/2 - 1/2)*(sqrt(27*a^2 - 14*a +
3)/(6*sqrt(3)) + (27*a - 7)/54)^(1/3) - 2*(-sqrt(3)*I/2 - 1/2)/(9*(sqrt(27*a^2
- 14*a + 3)/(6*sqrt(3)) + (27*a - 7)/54)^(1/3)) + 1/3, x == (sqrt(27*a^2 - 14*a
+ 3)/(6*sqrt(3)) + (27*a - 7)/54)^(1/3) - 2/(9*(sqrt(27*a^2 - 14*a +
3)/(6*sqrt(3)) + (27*a - 7)/54)^(1/3)) + 1/3]
You know one of the roots should evaluate to 1 for a=1, in fact it is sol[2]:
sage: sol[2].subs(a=1).right().n()
1.00000000000000
Thus you have constructed a nice expression for 1:
sage: sol[2].subs(a=1).right()
(2/(3*sqrt(3)) + 10/27)^(1/3) - 2/(9*(2/(3*sqrt(3)) + 10/27)^(1/3)) + 1/3
Quiz: how to simplify that expression to 1 within SAGE? I've tried simplify,
and radical_simplify, but neither succeeds...
Paul Zimmermann
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---