∫ 0 x [ ∫ 0 u φ ( t ) d t ] d u = ∫ 0 x [ ∫ t x φ ( t ) d u ] d t 淡然的过客int_0^x 淡然的过客left[ 淡然的过客int_0^u 淡然的过客varphi(t)dt淡然的过客right] du = 淡然的过客int_0^x 淡然的过客left[ 淡然的过客int_t^x 淡然的过客varphi(t)du淡然的过客right] dt ∫0x[∫0uφ(t)dt]du=∫0x[∫txφ(t)du]dt
Explanation As for double integralsMaybe we can understand the double integrals from the perspective of code, and the above formula are equivalent to the following two sum.
sum1 = 0for u in 0:d1:x:for t in 0:d2:u:sum1 += varphi(t)*d1*d2print sum1sum2 = 0for t in 0:d1:x:for u in t:d2:x:sum2 += varphi(t)*d1*d2print sum2
First code: u=0 at first, and after
for t in 0:d2:u:sum1 += varphi(t)*d1*d2sum1 = 0;
Then u become a little bigger, we do this cycle again. Finally, we can get the the volume accumulated by φ ( t ) 淡然的过客varphi(t) φ(t) on this triangle.
Second code: And yet, we can also treat this idea from another angle. In the first place, t=0, and we execute:
for u in t:d2:x:sum2 += varphi(t)*d1*d2After t increase, we do this cycle again and again, we can also get the the volume accumulated by φ ( t ) 淡然的过客varphi(t) φ(t) on this triangle.
That’s all.
#Purpose
How does this artifice work in reality?
I don’t know if you notice that or not, but
sum2 = 0for t in 0:d1:x :for u in t:d2:x :sum2 += varphi(t)*d1*d2print sum2is equivalent to
sum2 = 0for t in 0:d1:x :sum2 += varphi(t)*d1*(x-t)print sum2The reduction in the number of dimensions reduces the number of cycles. That’s why it’s useful.
∫ 0 x [ ∫ 0 u φ ( t ) d t ] d u = ∫ 0 x [ ∫ t x φ ( t ) d u ] d t = ∫ 0 x [ ( x − t ) φ ( t ) ] d t 淡然的过客int_0^x 淡然的过客left[ 淡然的过客int_0^u 淡然的过客varphi(t)dt淡然的过客right] du = 淡然的过客int_0^x 淡然的过客left[ 淡然的过客int_t^x 淡然的过客varphi(t)du淡然的过客right] dt =淡然的过客int_0^x 淡然的过客left[ (x-t) 淡然的过客varphi(t)淡然的过客right] dt ∫0x[∫0uφ(t)dt]du=∫0x[∫txφ(t)du]dt=∫0x[(x−t)φ(t)]dt