On Sat, May 23, 2009 at 2:40 PM, Luke wrote:
>
> It seems there is a bug:
> [matlab]
>>> integrand = 2*X*X + 2*Y*Y - 1
> integrand =
> 2*X^2+2*Y^2-1
>>> res = int(integrand, Y, -sqrt(1-X*X), sqrt(1-X*X))
> res =
> 4*X^2*(1-X^2)^(1/2)+4/3*(1-X^2)^(3/2)-2*(1-X^2)^(1/2)
>>> subs(res, X, 1)
> ans =
>
It seems there is a bug:
[matlab]
>> integrand = 2*X*X + 2*Y*Y - 1
integrand =
2*X^2+2*Y^2-1
>> res = int(integrand, Y, -sqrt(1-X*X), sqrt(1-X*X))
res =
4*X^2*(1-X^2)^(1/2)+4/3*(1-X^2)^(3/2)-2*(1-X^2)^(1/2)
>> subs(res, X, 1)
ans =
0
>> subs(res, X, 2)
ans =
0. +17.3205i
>>
[/matlab]
that is a bad news :(
I have thought to use py+sympy in my research work, but think I'd
better turn to matlab now.
On May 23, 2:57 am, Luke wrote:
> I get a slightly different result when integrating in Matlab (2008a):
> [matlab]
>
> >> syms X Y L H K;
> >> int(int(2*X*X+2*Y*Y-1, Y, -sqrt(1-X*X)
I get a slightly different result when integrating in Matlab (2008a):
[matlab]
>> syms X Y L H K;
>> int(int(2*X*X+2*Y*Y-1, Y, -sqrt(1-X*X), sqrt(1-X*X)), X, L, 1)
ans =
-2/3*(1-L^2)^(1/2)*L*(L-1)*(1+L)
>> expand(ans)
ans =
2/3*(1-L^2)^(1/2)*L-2/3*(1-L^2)^(1/2)*L^3
[/matlab]
In sympy, it se