By answer wrong I mean the answer given by sympy,
On Friday, July 6, 2012 10:06:57 PM UTC-4, pallab wrote:
>
>
> The answer seems to be wrong.
> I do the following to numerically integral evaluation:
>
> import numpy as np
> import scipy as sp
> import scipy.integrate
>
> f=lambda x:np.sqrt(np.sin(x))
>
> sp.integrate.quad(f,0.6,0.7)
>
> get the following value:
>
> 0.07776347731181982
>
>
> which matches with mathematica.
>
> whereas
>
>
> fI=sm.lambdify(z,sm.integrate(dydz(z)*tointegrate.subs(subdict)).subs(sm.exp_polar(2*sm.I*sm.pi),1.0))
>
> and
>
> fI(0.6)-fI(0.7)
>
> gives:
>
> mpf('-0.10638922100995812')
>
>
> On Friday, July 6, 2012 12:00:19 PM UTC-4, pallab wrote:
>>
>>
>>
>> It seems sympy can not integrate sqrt(sin(x)).
>>
>> I did the following:
>>
>> import sympy as sm
>> from sympy.abc import x,y,z
>>
>> tointegrate=sm.sqrt(sm.sin(y))
>> sm.integrate(tointegrate)
>>
>> output is : Integral(sqrt(sin(y)), y)
>>
>> After a simple change of variable the integral is doable:
>>
>> def ytoz(z):
>> return(sm.asin(z))
>>
>> def dydz(z):
>> return(sm.diff(ytoz(z),z))
>>
>> subdict={y:cvytoz(z)}
>> sm.integrate(dydz(z)*tointegrate.subs(subdict))
>>
>> output is : z**(3/2)*gamma(3/4)*hyper((1/2, 3/4), (7/4,),
>> z**2*exp_polar(2*I*pi))/(2*gamma(7/4))
>>
>> best,
>>
>> Pallab
>>
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sympy/-/mznZeEQ6kcgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.