Hi, On Sun, 4 Jul 2010 05:36:50 -0700 (PDT) dirkd <dirk.dancka...@gmail.com> wrote:
> 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: <snip> > File "expression.pyx", line 3797, in > sage.symbolic.expression.Expression.n (sage/symbolic/expression.cpp: > 17022) > TypeError: cannot evaluate symbolic expression numerically > > > If I leave out the N( )-operator on the last line the block evaluates > to > > > 1/500*sum(abs(-4*k^2 - 56*k + 329), k, 1, 10) > > which can be evaluated in a new inputbox. Why not in one step? The result returned from maxima uses a symbolic function object created on the fly. This is quite different from the sum() function available on the command line, and unfortunately, it doesn't define a numerical evaluation function, _evalf_(). If no one beats me to it, I will provide a symbolic sum function in the next few days. I opened a ticket for this problem: http://trac.sagemath.org/sage_trac/ticket/9424 Thanks for the report. Burcin -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org