#18092: evaluating symbolic expressions (without conversion to SR, i.e.,
staying in
ring of values)
-------------------------+-------------------------------------------------
Reporter: | Owner:
dkrenn | Status: needs_info
Type: | Milestone: sage-6.6
enhancement | Resolution:
Priority: major | Merged in:
Component: | Reviewers:
symbolics | Work issues:
Keywords: sd66 | Commit:
Authors: | 276f0f3d3583c66c7e137350c578e8588c9b236d
Daniel Krenn | Stopgaps:
Report Upstream: N/A |
Branch: |
u/dkrenn/SR/eval |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by dkrenn):
Replying to [comment:25 vdelecroix]:
> Replying to [comment:24 dkrenn]:
> > Replying to [comment:23 vdelecroix]:
> > > Replying to [comment:22 dkrenn]:
> > > > Replying to [comment:21 vdelecroix]:
> > > > > Would this ticket solve the following issue (from #9787)?
> > ...
> > > Sorry. This was not my question. What would be `parent(f(1.2))`? Is
this modified by this ticket?
> >
> > No, not modified by this ticket.
>
> I saw too late your answer on #9878 ;-)
>
> By the way, let me repeat another question from #9878. I found the
behavior of `evaluate` in your [comment:22 comment:22] very weird. I
thought it was a modification of `.subs` in order to take care of the
parent.
In the following it does the same as subs:
{{{
sage: sage: f(x) = 2*x
sage: sage: f(x).subs(x=3)
6
sage: sage: f(x).evaluate(x=3)
6
}}}
> But
> {{{
> sage: f(x) = 2*x
> sage: f.subs(x=3)
> x |--> 6
> }}}
> ie, `f` remains a function. It is hopefully not changed into a number.
Indeed, this changes (I wasn't aware of this up to now):
{{{
sage: sage: f.evaluate(x=3)
6
}}}
This is because `evaluate` uses
{{{
sage: f.operator()
<built-in function mul>
sage: f.operands()
[x, 2]
}}}
From this, `f` is equal to `2*x`. Sage sees these two as equal as well:
{{{
sage: bool(f == 2*x)
True
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/18092#comment:26>
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.