Santanu Sarkar a écrit :
How one can find integral abs(cos(x+y)) where x varies from 0 to pi
and y varies from 0 to pi in Sage?
You must help Sage (in fact Maxima bellow) for these integrals.
cos(x+y) >= 0 for 0 <= x+y <= pi/2 or 3*pi/2 <= x+y <= 2*pi
cos(x+y) <= 0 for pi/2 <= x+y <= 3*pi/2
First I look at the 2 lines x+y=pi/2 and x+y=3*pi/2 inside the square
[0,pi]^2.
And I add multiple integrals.
var('x,y')
I1a = integrate (cos(x+y), x, 0, pi/2-y)
I1b = integrate (cos(x+y), x, pi/2-y, pi)
I1 = integrate (I1a-I1b, y, 0, pi/2)
I2a = integrate (cos(x+y), x, 0, 3*pi/2-y)
I2b = integrate (cos(x+y), x, 3*pi/2-y, pi)
I2 = integrate (I2b-I2a, y, pi/2, pi)
I1+I2 # I get 2*pi.
I verify it with a numerical calculus :
The integral looks like a sum of sum of square :
L = [N(0.001*k*pi) for k in [1..1000]]
N (add (add (abs (cos (x+y)) for x in L) for y in L) *pi^2/1000^2))
The result is about 6.283180... near from 2*pi...
--
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/sage-support
URL: http://www.sagemath.org