#9424: FP evaluation of symbolic sums fails
-------------------------------+--------------------------
Reporter: burcin | Owner: burcin
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-6.4
Component: symbolics | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------+--------------------------
Old description:
> Symbolics sums returned from maxima cannot be numerically evaluated,
> since they don't define an `_evalf_()` method.
>
> This was reported by dirkd on sage-support:
>
> {{{
> Why is evaluating this expression problematical?
>
> y1(x)=x^2;y2(x)=5-x;
> a0=1;an=3;Delta=(an-a0)/n;p(k)=a0+(k-1/2)*Delta;
> I(n)=sum(abs(y2(p(k))-y1(p(k)))*Delta,k,1,n);
> N(I(10))
>
> SAGE respons:
> <snipped traceback>
> File "expression.pyx", line 3797, in
> sage.symbolic.expression.Expression.n (sage/symbolic/expression.cpp:
> 17022)
> TypeError: cannot evaluate symbolic expression numerically
> }}}
>
> Here is the thread:
>
> http://groups.google.com/group/sage-support/t/615b15ca638c9652
New description:
Symbolics sums returned from maxima cannot be numerically evaluated, since
they don't define an `_evalf_()` method.
This was reported by dirkd on sage-support:
{{{
Why is evaluating this expression problematical?
y1(x)=x^2;y2(x)=5-x;
a0=1;an=3;Delta=(an-a0)/n;p(k)=a0+(k-1/2)*Delta;
I(n)=sum(abs(y2(p(k))-y1(p(k)))*Delta,k,1,n);
N(I(10))
SAGE respons:
<snipped traceback>
File "expression.pyx", line 3797, in
sage.symbolic.expression.Expression.n (sage/symbolic/expression.cpp:
17022)
TypeError: cannot evaluate symbolic expression numerically
}}}
Here is the thread:
http://groups.google.com/group/sage-support/t/615b15ca638c9652
See also #17422
--
Comment (by rws):
Replying to [comment:12 kcrisman]:
> Maybe it's time we fixed this.
It is not clear if forcing people to use `N()` and getting a float, even
if there is an integer simplification of the sum, is the right thing to
do. Granted, the error thrown on `N(I(10))` is a bug, and this ticket is
about it. Here is a minimal example:
{{{
sage: (k,n) = var('k,n')
sage: f(n)=sum(abs(-k*k+n),k,1,n)
sage: f(n=8)
sum(abs(-k^2 + 8), k, 1, 8)
sage: N(f(8))
}}}
However, I would expect `f(n=8).simplify()` or `.expand()` to give me the
result `162`, and this is #17422
--
Ticket URL: <http://trac.sagemath.org/ticket/9424#comment:13>
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.