1. 程式人生 > >技巧---數學分析1:變換積分次序

技巧---數學分析1:變換積分次序

Formula

0x[0uφ(t)dt]du=0x[txφ(t)du]dt

Explanation

As for double integrals

Maybe we can understand the double integrals from the perspective of code, and the above formula are equivalent that the following two sum are same.

sum1 = 0
for u in 0:d1:x:
    for t in 0:d2
:u: sum1 += varphi(t)*d1*d2 print sum1 sum2 = 0 for t in 0:d1:x: for u in t:d2:x: sum2 += varphi(t)*d1*d2 print sum2

這裡寫圖片描述

First code: u=0 at first, and after

    for t in 0:d2:u:
        sum1 += varphi(t)*d1*d2

sum1 = 0; Then u become a little bigger, we do this cycle again. Finally, we can get the the volume accumulated by

φ(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*d2

After t increase, we do this cycle again and again, we can also get the the volume accumulated by φ(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 = 0
for t in 0:d1:x :
    for u in t:d2:x :
        sum2 += varphi(t)*d1*d2
print sum2

is equivalent to

sum2 = 0
for t in 0:d1:x :
    sum2 += varphi(t)*d1*(x-t)
print sum2

The reduction in the number of dimensions reduces the number of cycles. That’s why it’s useful.

0x[0uφ(t)dt]du=0x[txφ(t)du]dt=0x[(xt)φ(t)]dt