Convolution

Example – Calculate Bank Interest

QPlease calculate the total money(INTEREST + MONEY_DEPSITED) in the bank in the first 4 months separately.

Bank

  • The interest of this bank is proportional to the time(month) of depositing money.
  • INTEREST = TIME_DEPSITE * MONEY_DEPSITED

Client

  • The money a client deposited is also proportional to the time(month).
  • MONEY_DEPSITED = MONTH

Solution A – Make List

MonthMONEY_DEPSITEDTOTAL
1(Jan)1(Jan)1 = {1 + 1 * 0}(Jan)
2(Feb)1 + 2(Feb)4 = {1 + 1 * 1}(Jan) + {2 + 2 * 0}(Feb)
3(Mar)1 + 2 + 3(Mar)10 = {1 + 1 * 2}(Jan) + {2 + 2 * 1}(Feb) + {3 + 3 * 0}(Mar)
4(Apr)1 + 2 + 3 + 4(Apr)20 = {1 + 1 * 3}(Jan) + {2 + 2 * 2}(Feb) + {3 + 3 * 1}(Mar) + {4 + 4 * 0}(Apr)

Solution B – Convolution

  • Interest(month) = conv(Bank(month), Client(month))
  • That is, Interest(month) = Sigma(Bank(time_passed) * Client(month – time_passed)) [PS: time_passed is the variable for Sigma]
  • Therefore, Total(month) = Client(month – time_passed)+ Interest(month)
MonthMax Passed TimeInterestTOTAL
10Bank(0) * Client(1 – 0) = 0 * 1 = 01 = (1) + 0
21Bank(1) * Cilent(2 – 1) + Bank(0) * Client(2 – 0) = 1 * 1 + 0 * 2 = 14= (1+2) + 1
32Bank(2) * Client(3 – 2) + Bank(1) * Client(3 – 1) + Bank(0) * Client(3 – 0) = 2 * 1 + 1 * 2 + 3 * 0 = 410 = (1 + 2 + 3) + 4
43Bank(3) * Client(4 – 3) + Bank(2) * Client(4 – 2) + Bank(1) * Client(4 – 1) + Bank(0) * Client(4 – 0) = 3 * 1 + 2 * 2 + 3 * 1 + 4 * 0 = 1020 =(1 + 2 + 3 + 4 )+ 10

Conclusion

  • I think the convolution is the Superposition of two functions at the same time stamp in essence, and that is the reason why one of the functions has to reverse the time. (Time Alignment).
  • That is to say, we can use convolution operation to describe the mixed output of two or more functions interacting over time.

Leave a Reply

Your email address will not be published. Required fields are marked *