I want to solve a BVP $y^{\prime\prime}(t)+y^{2}(t)-t^{4}-2=0$, with BCs $y(0)=0, y(1)=1$. Solving $x^{\prime\prime}=0$ with the BCs, we get the initial approximation $x_{0}=t$. The exact solution is $y(t)=t^{2}$ where $t\in[0,1]$. Now I apply my method (called Khan-Green) to find the approximate solution as follows (here I use 20 iteration, i.e., Khan-Green x20:

Clear[a, b, x, z, y, t, s]
\[Delta] = 10^-30;
x[0] = Function[t, t];
a[n_] := a[n] = 0.2;
x[n_] :=x[n] = Function[t,Evaluate[Chop[Expand[x[n-1][t]+a[n]*Integrate[s(1-t)(x[n-1]''[s]+x[n-1][s]^2-s^4-2),{s,0,t}] + a[n]*Integrate[t(1-s)(x[n-1]''[s]+x[n-1][s]^2-s^4-2),{s,t,1}]],\[Delta]]]]
a1a = Table[x[n][0.5], {n, 0, 20}]

When I run my code for 20 iterations and $t=0.5$. Then Cleary my method converges to $0.25$ which the approximate solution of my BVP for $t=0.5$. Now I want to plot the graph (t vs solution ($y(t)=t^{2}$) and my method. In fact I need a graph like given in the picture.

0.5, 0.454063, 0.416396, 0.385568, 0.360377, 0.339817, 0.323054,0.309398, 0.298281, 0.289235,0.281878, 0.275896, 0.271035, 0.267084,0.263874, 0.261267, 0.259149, 0.25743, 0.256033, 0.254898, 0.253977

enter image description here



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy