0

I want to solve a pde $y^{\prime\prime}(t)=\frac{3}{2}y(t)^{2}$ with boundary conditions $y(0)=4$ and $y(1)=1$. The exact solution of this problem is $y(t)=\frac{4}{(1+t)^{2}}$. Now I want to solve this by an iterative method In the attached Picture enter image description here

δ = 10^-20;
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[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}]], \[Delta]]]];
Table[Abs[x[i][0.5] - x[i + 1][0.5]], {i, 0, 20}]

When I run the code I get "3.60822(10^-12) But in the Table it is "8.075267(10^-12)$.

Also for 0.5 the exact solution is 16/9. So that I also tried the following code for absolute error

Table[Abs[x[i][0.5] - (16/9)], {i, 0, 20}]

In this case I get (4.02495(10^-11) in both the case my answer is very near to the answer given in paper but I want to get the exact answer as given in the paper. This code works very well for some other papers but for this paper the problem is still exists. I also changed the value of delta but cant succeeded. The complete paper is at https://sci-hub.hkvisa.net/10.1016/j.aml.2018.02.016

The authors used Matlab softwhare but I used Mathematica. This post is related with How to compute higher iterations in mathemtica and Mathematica does not show anything after running for higher iterations

Junaid
  • 161
  • 6
  • Those appear to be errors due to using machine-precision numbers. You might want to try re-running the code using exact numbers, i.e., substitute 1/2 for 0.5, 3/2 for 1.5, and 5947894739/10^10 for 0.5947894739. I tried doing that myself, but when the computation didn't finish in 20 min. I gave up, as I needed to do other work in MMA. You might want to try running your code with exact numbers overnight. [Machine-precision calcs are run on hardware, while MMA's exact calcs require an intervening softeware layer, so are slower.] If you get an answer, you can then numericise the results. – theorist Apr 14 '22 at 22:38
  • 1
    You could ask the authors what software they used to generate the table. Papers should really include any code they used for generating results in the appendix, or make that available. – Nasser Apr 14 '22 at 22:49
  • Dear @Nasser they used Matlab software I discussed with them. – Junaid Apr 14 '22 at 22:50
  • Change the Table to a Do and print the results as you go (after following the advice from @theorist). I get $i$ from 0 to 9 to go real fast but then things slow down considerably for 10 to 20 for Table[Abs[x[i][0.5] - (16/9)], {i, 0, 20}]. – JimB Apr 14 '22 at 22:59
  • Dear @theorist thanks for your kind hints. I run the code according to your suggestions but I obtained the same answars. – Junaid Apr 14 '22 at 23:12
  • Did you get symbolic answers that you had to numericise, or did you get numerical answers? [Just as an example: symbolic = Sqrt[2]/3; numeric = 0.471405.] I ask because if you got the latter, it means you missed converting one of the decimals to an exact number (which sometimes happens). – theorist Apr 14 '22 at 23:18
  • Dear @theorist when I changed all the values then I get very lengthy calculations – Junaid Apr 14 '22 at 23:22
  • And when you then numericised the results from these lengthy calculations (e.g., by doing N[result, 20] did you get the same answers as you got originally? – theorist Apr 14 '22 at 23:25
  • The paper says the value 8.075267(−12) is for t=0.5. Are you sure you comparing at your result 3.60822(10^-12) at same t? Also you use Chop. How do you know Matlab implementation did same thing? I think it is implementation issues. You also using memoization and paper seems to be using straight iteration. Not sure if this has anything to do with it. The best thing is to ask Authors to send you the Matlab code. Then you will know the truth :) – Nasser Apr 14 '22 at 23:25
  • If remove chop than I get more problems. – Junaid Apr 15 '22 at 02:50
  • Dear @Nasser I asked many times for the Matlab code but they do not give my email reply. – Junaid Apr 15 '22 at 02:52
  • 1
    If such a numerical scheme takes hrs to finish using only 20 iterations as you show, then it is probably not a good one to start with ! – Nasser Apr 15 '22 at 03:10
  • One thing that's unclear from the paper is, how do they implement the integral? In your Mathematica code you've relied on symbolic calculation, which makes the calculation rather slow. What if you turn to numeric integration? (Since the author of paper uses MATLAB, it's reasonable to guess they uses numeric integration. ) – xzczd Apr 27 '22 at 05:46

0 Answers0