0
$\begingroup$

Consider a BVP: $y^{\prime\prime}=\frac{3}{2}y(t)^{2}$ with the boundary conditions $y(0)=4$ and $y(1)=1$. The exact solution is $y(t)=\frac{4}{(1+t)^{2}}$ and the initial guess is $y(t)=4-3t$. Now I want to solve this BVP by an iteration method in mathemetica. The code is given below, which works well for $n=5$ but when I put $n=20$ it doest show anything after running for some time.

δ = 10^-100;
Clear[x];
x[0] = Function[t, 4 - 3 t];
a[n_] := a[n] = 0.5947894739;
x[n_] := x[n] = Function[t,Evaluate[Chop[Expand[x[n - 1][t]+a[n]*Integrate[s (1 - t) (x[n-1]''[s] - (1.5) x[n - 1][s]^2), {s, 0, t}] +a[n]*Integrate[t (1 - s) (x[n - 1]''[s] - (1.5) x[n - 1][s]^2), {s,t,1}]], δ]]];
NumberForm[a0 = {Table[x[i][0.5], {i, 0, 5}]}]
$\endgroup$
2

1 Answer 1

2
$\begingroup$

With an extra Expand before integration, it works:

δ = 10^-100;
a[n_] = 0.5947894739;
Clear[x];
x[0] = Function[t, 4 - 3 t];
x[n_] := x[n] = Function[t, Evaluate[
 Chop[Expand[
   x[n - 1][t] +
   a[n]*Integrate[Expand[s (1 - t) (x[n - 1]''[s] - (1.5) x[n - 1][s]^2)], {s, 0, t}] +
   a[n]*Integrate[Expand[t (1 - s) (x[n - 1]''[s] - (1.5) x[n - 1][s]^2)], {s, t, 1}]], δ]]];

Table[x[i][0.5], {i, 0, 20}]
(*    {2.5, 1.76116, 1.77104, 1.77548, 1.77701, 1.77752, 1.77769,
       1.77775, 1.77777, 1.77777, 1.77778, 1.77778, 1.77778, 1.77778,
       1.77778, 1.77778, 1.77778, 1.77778, 1.77778, 1.77778, 1.77778}    *)
$\endgroup$
10
  • $\begingroup$ Dear @Roman, when I calculate absolute error by replacing x[i][0.5] with Abs[x[i][0.5]-1.77778] it shows error 2.22228*10^-6 but in the paper sciencedirect.com/science/article/pii/S0893965918300533 see table2 the error for 20 iteration is 8.075267(-12) for t=0.5 $\endgroup$
    – Junaid
    Mar 23, 2022 at 15:37
  • $\begingroup$ The correct answer is $16/9$, not $1.77778$. Try x[20][0.5] - 16/9 which gives $-5.40208\times10^{-11}$. $\endgroup$
    – Roman
    Mar 23, 2022 at 15:48
  • $\begingroup$ Thanks dear @Roman but this answar is still from the paper I mentioned $\endgroup$
    – Junaid
    Mar 23, 2022 at 15:54
  • $\begingroup$ Are you sure your a[n] contains all the necessary digits for getting the exact answer from your paper? $\endgroup$
    – Roman
    Mar 23, 2022 at 15:58
  • $\begingroup$ Dear @Roman yes I have checked all. The paper is in the link I mentioned above. $\endgroup$
    – Junaid
    Mar 23, 2022 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.