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: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_109.py", line 9, in <module> open("___code___.py","w").write("# -*- coding: utf-8 -*-\n" + _support_.preparse_worksheet_cell(base64.b64decode("eTEoeCk9eF4yO3kyKHgpPTUteDsKYTA9MTthbj0zO0RlbHRhPShhbi1hMCkvbjtwKGspPWEwKyhrLTEvMikqRGVsdGE7Ckkobik9c3VtKGFicyh5MihwKGspKS15MShwKGspKSkqRGVsdGEsaywxLG4pOwpOKEkoMTApKQ=="),globals()) +"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/tmp/tmpk0DnhJ/___code___.py", line 6, in <module> N(I(_sage_const_10 )) File "", line 1, in <module> File "/home/sage/sage/local/lib/python2.6/site-packages/sage/misc/ functional.py", line 1165, in numerical_approx return x.numerical_approx(prec) 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? -- 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