On Sun, May 13, 2012 at 7:23 AM, Dima Pasechnik <[email protected]> wrote:
> On 2012-05-11, mmarco <[email protected]> wrote:
>> I have noticed that it is not possible to mix algebraic numbers and
>> symbolic expressions. Would it be very difficult to make the symbolic
>> ring support algebraic numbers?
> symbolics are mostly(?) handled by Maxima interface,

Before Sage-4.0, Maxima did most everything for the Sage symbolic
ring.  Now it is GINAC for all arithmetic, and maxima for a few big
things like symbolic integration.

It might be useful to work with floating point approximations to the
algebraic numbers and ask for the minpoly of any particular one later.
 If a is symbolic, then a.minpoly(...) computes -- using a nice
implementation due I think to Robert Bradshaw -- the minpoly.  Watch
out though, since the docstring for a.minpoly? is way too sparse to be
useful. Instead, look at the excellent docstring for

sage: sage.calculus.calculus.minpoly?

which is what is really used on the underlying pyobject.

If your algebraic number is radical, you can coerce it to the Symbolic Ring:


sage: R.<x> = QQ[]
sage: K.<a> = NumberField(x^3-x-1, embedding=(x^3-x-1).roots(RR)[0][0])
sage: SR(a)
1/3*(3*(1/18*sqrt(3)*sqrt(23) + 1/2)^(2/3) + 1)/(1/18*sqrt(3)*sqrt(23)
+ 1/2)^(1/3)

If it isn't radical, the number is converted to double precision:

sage: K.<a> = NumberField(x^5-2*x^2-1, embedding=(x^5-2*x^2-1).roots(RR)[0][0])
sage: SR(a)
1.363964687
sage: sqrt(2) + a
sqrt(2) + 1.363964687

I'm not sure I'm happy with the above.

For functionality that doesn't use Maxima, I don't think there is any
real technical obstruction to making pynac (=sage's version of ginac)
support them.   I was reading through the source code of ginac for
some other reason (thinking about how to make noncommuting variables)
a few days ago.

As motivation, what is a good example of what *you* want to do with
symbolics + algebraic numbers.

>  and Maxima doesn't really
> know about algebraic numbers, AFAIK.
>
>
>
> --
> To post to this group, send an email to [email protected]
> To unsubscribe from this group, send an email to 
> [email protected]
> For more options, visit this group at 
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to