Shared15.5-6-Triple_Integration.sagewsOpen in CoCalc


var('x,y,z')
(x, y, z)
### First example
f = x + y + z
I1 = integral(f, z, 0, 1); I1
x + y + 1/2
I2 = integral(I1, x, y^2, 1); I2
-1/2*y^4 - y^3 - 1/2*y^2 + y + 1
I3 = integral(I2, y, -1, 1); I3
22/15
### Second example (volume)
f = 1
I1 = integral(f, z, 0, 2-y); I1
-y + 2
I2 = integral(I1, y, 0, 4 - x^2); I2
-1/2*x^4 + 2*x^2
I3 = integral(I2, x, 0, 2); I3
32/15
### Mass from density
delta = 2*x
M = integral(integral(integral(delta, z, 0, 2-x-y), y, 0, 2-x), x, 0, 2)
M
4/3
### Center of mass
Myz = integral(integral(integral(x*delta, z, 0, 2-x-y), y, 0, 2-x), x, 0, 2)
Mxz = integral(integral(integral(y*delta, z, 0, 2-x-y), y, 0, 2-x), x, 0, 2)
Mxy = integral(integral(integral(z*delta, z, 0, 2-x-y), y, 0, 2-x), x, 0, 2)
(Myz/M, Mxz/M, Mxy/M)
(4/5, 2/5, 2/5)
### Moments of inertia
Ix = integral(integral(integral((y^2 + z^2)*delta, z, 0, 2-x-y), y, 0, 2-x), x, 0, 2)
Iy = integral(integral(integral((x^2 + z^2)*delta, z, 0, 2-x-y), y, 0, 2-x), x, 0, 2)
Iz = integral(integral(integral((x^2 + y^2)*delta, z, 0, 2-x-y), y, 0, 2-x), x, 0, 2)
(Ix, Iy, Iz)
(32/45, 64/45, 64/45)
var('x,y,z,a,b,c')

(x, y, z, a, b, c)
I1 = integral(1, z, 0, c - c/a*x - c/b*y); I1
c - c*x/a - c*y/b
I2 = integral(I1, y, 0, b - b/a*x); I2
1/2*(a^2*b*c - 2*a*b*c*x + b*c*x^2)/a^2
I3 = integral(I2, x, 0, a); I3
1/6*a*b*c