[sage-support] numerical evaluation

2010-08-23 Thread robin hankin
Hi thanks for your earlier answers. I quite often do this: sage: solve(x^3 + 10*x^2+11*x+8==0,x) [snip] Then I realize that the analytic solution is rather complicated. So I want a numerical approximation. I tried this: roots = solve(x^3+10*x^2+11*x+8==0,x) sage: roots [x ==

Re: [sage-support] numerical evaluation

2010-08-23 Thread Soroosh Yazdani
I'm not sure if this helps your situation or not, but if you are interested in the roots of f(x)=0, then using roots has a much more predictable behaviour. So for example: sage: expr=(x^3+10*x^2+11*x+8) sage: expr.roots() snip sage: expr.roots(ring=RR) [(-8.86042628425072, 1)] sage:

[sage-support] numerical evaluation of symbolic expressions

2010-07-04 Thread dirkd
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

Re: [sage-support] numerical evaluation of symbolic expressions

2010-07-04 Thread Burcin Erocal
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

[sage-support] numerical evaluation of integral?

2008-12-03 Thread Stan Schymanski
Dear all, I would like to evaluate a symbolic equation containing an integral numerically: ((integrate(250*cos(pi*x/180)^1.8 + 170.35,x,0,18)/a_v)(a_v=1)).n() does not work. Is there a way of doing this? The real equation is a lot longer than the above, so I am looking for a simple automatic