#18092: evaluating symbolic expressions (without conversion to SR, i.e.,
staying in
ring of values)
-------------------------+-------------------------------------------------
Reporter: | Owner:
dkrenn | Status: needs_review
Type: | Milestone: sage-6.6
enhancement | Resolution:
Priority: major | Merged in:
Component: | Reviewers:
symbolics | Work issues:
Keywords: | Commit:
Authors: | c3696a81f65df6e64c5e2bcbdf8905d4f2d5b796
Daniel Krenn | Stopgaps:
Report Upstream: N/A |
Branch: |
u/dkrenn/SR/eval |
Dependencies: |
-------------------------+-------------------------------------------------
Old description:
> {{{subs}}} of a symbolic expression converts its values to the symbolic
> ring before performing the actual substitution. This ticket proposes a
> new method {{{evaluate}}} which comes over this.
> {{{
> sage: E = (1+x).evaluate(x=RIF(3.42))
> sage: E
> 4.4200000000000000?
> sage: E.parent()
> Real Interval Field with 53 bits of precision
> }}}
New description:
{{{subs}}} of a symbolic expression wraps its values to the symbolic ring
(if possible) before performing the actual substitution. This ticket
proposes a new method {{{evaluate}}} which comes over this.
{{{
sage: E = (1+x).evaluate(x=RIF(3.42))
sage: E
4.4200000000000000?
sage: E.parent()
Real Interval Field with 53 bits of precision
}}}
While in the example above you can come over this by doing a conversion
afterwards, it changes with power series:
{{{
sage: P.<p> = ZZ[[]]
sage: x.subs(x=p)
Traceback (most recent call last):
...
TypeError: no canonical coercion from Power Series Ring in p over Integer
Ring to Symbolic Ring
sage: E = x.evaluate(x=p)
sage: E, E.parent()
p, Power Series Ring in p over Integer Ring)
}}}
--
Comment (by dkrenn):
Replying to [comment:4 rws]:
> I think you misunderstand. `x` is not converted, it is wrapped in an
expression:
Ok, I used the wrong word; however, this example was to point out the
differences between the two commands.
> {{{
> sage: x.subs(x=RIF(3.42)).pyobject().parent()
> Real Interval Field with 53 bits of precision
> }}}
> I have no idea if your idea is worth the effort, but suspect that not if
it is only based on the necessity to prevent "conversion".
{{{subs}}} is not possible with something that does go into the symbolic
ring, like power series:
{{{
sage: P.<p> = ZZ[[]]
sage: x.subs(x=p)
Traceback (most recent call last):
...
TypeError: no canonical coercion from Power Series Ring in p over Integer
Ring to Symbolic Ring
sage: E = x.evaluate(x=p)
sage: E, E.parent()
p, Power Series Ring in p over Integer Ring)
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/18092#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.