0
$\begingroup$

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

$\endgroup$
13
  • $\begingroup$ 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. $\endgroup$
    – theorist
    Apr 14 at 22:38
  • 1
    $\begingroup$ 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. $\endgroup$
    – Nasser
    Apr 14 at 22:49
  • $\begingroup$ Dear @Nasser they used Matlab software I discussed with them. $\endgroup$
    – Junaid
    Apr 14 at 22:50
  • $\begingroup$ 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}]. $\endgroup$
    – JimB
    Apr 14 at 22:59
  • 1
    $\begingroup$ 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 ! $\endgroup$
    – Nasser
    Apr 15 at 3:10

0

Your Answer

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

Browse other questions tagged or ask your own question.