online advertising
Loading [MathJax]/jax/output/HTML-CSS/jax.js

Saturday, November 21, 2015

Scientific Computing - Quiz 1 - Question 8

Problem:

Derive the Adams-Moulton scheme and Adams-Bashforth scheme that uses yn+1,yn,fn1 and yn,fn1,fn2 respectively.

Solution:

To approximate a polynomial with three points, we use the Lagrange's polynomial.

p(t)=fn(t(n1)Δt)(t(n2)Δt)(nΔt(n1)Δt)(nΔt(n2)Δt)+fn1(tnΔt)(t(n2)Δt)((n1)ΔtnΔt)((n1)Δt(n2)Δt)+fn2(tnΔt)(t(n1)Δt)((n2)ΔtnΔt)((n2)Δt(n1)Δt)=fn(t(n1)Δt)(t(n2)Δt)2Δt2+fn1(tnΔt)(t(n2)Δt)Δt2+fn2(tnΔt)(t(n1)Δt)2Δt2=12Δt2(fn(t(n1)Δt)(t(n2)Δt)2fn1(tnΔt)(t(n2)Δt)+fn2(tnΔt)(t(n1)Δt))

Note that while the expression is long, it is simply a quadratic polynomial with a lot of awful looking constants. To simplify things, let u=tnΔt

p(u)=12Δt2(fn(u+Δt)(u+2Δt)2fn1(u)(u+2Δt)+fn2(u)(u+Δt))=12Δt2(fn(u2+3uΔt+2Δt2)2fn1(u2+2uΔt)+fn2(u2+uΔt))=12Δt2(u2(fn2fn1+fn2)+uΔt(3fn4fn1+fn2)+2fnΔt2)

Ugly as is, we can integrate now.

yn+1yn=tn+1tnf(t,y)dtyn+1=yn+tn+1tnf(t,y)dtyn+tn+1tnp(t)dtyn+Δt0p(u)duyn+Δt012Δt2(u2(fn2fn1+fn2)+uΔt(3fn4fn1+fn2)+2fnΔt2)duyn+12Δt2Δt0(u2(fn2fn1+fn2)+uΔt(3fn4fn1+fn2)+2fnΔt2)duyn+12Δt2(u33(fn2fn1+fn2)+u22Δt(3fn4fn1+fn2)+2ufnΔt2)|Δt0yn+12Δt2(Δt33(fn2fn1+fn2)+Δt32(3fn4fn1+fn2)+2Δt3fn)yn+Δt2(13(fn2fn1+fn2)+12(3fn4fn1+fn2)+2fn)yn+Δt12(2(fn2fn1+fn2)+3(3fn4fn1+fn2)+12fn)yn+Δt12(23fn16fn1+5fn2)

This is the Adam-Bashforth scheme - I will skip the Adam Moulton scheme, derivation like this is best leave to the computer...

We have the correct answer at https://en.wikipedia.org/wiki/Linear_multistep_method, and it is great to see the answer matches (to be honest to my future self, I did spend great time to fix the derivation to match the solution, the very detailed derivation does help me a lot to fix the bug without redoing everything)

No comments:

Post a Comment