On Mon, 14 May 2012 04:27:15 -0700 (PDT)
mmarco <[email protected]> wrote:
> I don't think the problem here is coercion, but conversion (and,
> mostly, the ability of the symbolic framework to handle these
> numbers).
The symbolics framework can handle these numbers. You can use
arbitrary python objects as coefficients in symbolic expressions.
Everything should work fine as long as they live in a field. Even a
commutative ring should be enough, but I'm not sure if some
normalization routines behave well in that case.
If you want to try without messing with coercions, convert the
algebraic numbers you will use as coefficients to symbolic constants
with SR._force_pyobject(). Then you can go through the computation and
see if there are any errors.
sage: K.<a> = NumberField(x^3-2)
sage: t = SR._force_pyobject(K.random_element())
sage: t
8/3*a^2 + 2/3*a + 1/3
sage: u = SR._force_pyobject(K.random_element())
sage: u
-31*a
sage: t*u
-62/3*a^2 - 31/3*a - 496/3
sage: var('x,y,z')
(x, y, z)
sage: t*x + exp(u*y^z)
(8/3*a^2 + 2/3*a + 1/3)*x + e^(-31*a*y^z)
Cheers,
Burcin
--
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