On Saturday, July 19, 2014 9:25:42 AM UTC-7, Anne Schilling wrote:
>
> Sage can solve this numerically: 
>
> sage: g = lambda x : (1+e^(2*pi*I*x)).abs() 
> sage: numerical_integral(g,0,1) 
> (1.2732395447351625, 1.4155343563970746e-14) 
> sage: n(4/pi) 
> 1.27323954473516 
>
> but not symbolically: 
>
> sage: integral(g,(x,0,1)) 

 
It can, but you have to give "integral" a symbolic expression, not a python 
function. You should probably not have wrapped the symbolic expression in a 
python function in the first place, but you can get it out again:

sage: g(x)
abs(e^(2*I*pi*x) + 1)
sage: integrate(g(x),x,0,1)
1/2*(2*pi - I)/pi + 1/2*I/pi

the latter simplifies to "1"

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to