0

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}]}]
bmf
  • 15,157
  • 2
  • 26
  • 63
Junaid
  • 161
  • 6
  • related: https://mathematica.stackexchange.com/q/264395/26598 – Roman Mar 23 '22 at 14:44
  • Dear @Roman I have posted the same problem at: https://mathematica.stackexchange.com/questions/268845/integration-does-not-converge-in-iteration – Ahmad Nawaz May 30 '22 at 07:59

1 Answers1

2

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} *)

Roman
  • 47,322
  • 2
  • 55
  • 121
  • 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 https://www.sciencedirect.com/science/article/pii/S0893965918300533 see table2 the error for 20 iteration is 8.075267(-12) for t=0.5 – Junaid Mar 23 '22 at 15:37
  • The correct answer is $16/9$, not $1.77778$. Try x[20][0.5] - 16/9 which gives $-5.40208\times10^{-11}$. – Roman Mar 23 '22 at 15:48
  • Thanks dear @Roman but this answar is still from the paper I mentioned – Junaid Mar 23 '22 at 15:54
  • Are you sure your a[n] contains all the necessary digits for getting the exact answer from your paper? – Roman Mar 23 '22 at 15:58
  • Dear @Roman yes I have checked all. The paper is in the link I mentioned above. – Junaid Mar 23 '22 at 16:03
  • The author used the same value for a[n] – Junaid Mar 23 '22 at 16:06
  • @Junaid the paper though is not available for free – bmf Mar 23 '22 at 16:21
  • Dear @Roman, the problem is due to the value of Delta I think. Because for higher terms, changing the value of it from 10^-20 to 10^-5 or to 10^-100 effects the last answar iteration value. Is there any way to fit the value of Delta automatic? – Junaid Mar 23 '22 at 16:22
  • Dear @Roman the paper is here for free https://sci-hub.hkvisa.net/10.1016/j.aml.2018.02.016 – Junaid Apr 03 '22 at 13:04
  • Dear @Roman can you help me the same in my new post at https://mathematica.stackexchange.com/questions/266766/numerical-values-of-an-iterative-scheme-are-different-from-values-in-a-paper?noredirect=1#comment665088_266766 – Junaid Apr 15 '22 at 22:12