0
$\begingroup$

The following code is incorrect, please specify my mistakes

y[0, t_] := 4 - 3 t;
y[n_, x_] := 4 - 3 x + 
  0.59489439*
   NIntegrate[ 
    t (1 - x) {D[y[n - 1], {t,2}] - 3/2 y[n - 1, t]^2}, {t, 0, x}] +
  0.594894
   NIntegrate[ 
    x (1 - t) {D[y[n - 1], {t,2}] - 3/2 y[n - 1, t]^2}, {t, x, 1}]
Table[{n, x, y[n, x]}, {n, 1, 3}, {x, .1, 1, .1}]
$\endgroup$
  • $\begingroup$ Here the integrand contains derivative term also. I couldn't get the answer. Please anyone correct my mistakes $\endgroup$ – Thenmozhi S Aug 17 at 13:09
  • $\begingroup$ Please edit your question and show the complete formula y[n,x]=... $\endgroup$ – Ulrich Neumann Aug 17 at 13:10
  • $\begingroup$ Equation edited $\endgroup$ – Thenmozhi S Aug 17 at 13:25
  • 1
    $\begingroup$ y[n-1,x]'' makes no sense. Please check out how to write partial derivatives. Something like D[y[n-1,x], {x,2}]. $\endgroup$ – Roman Aug 17 at 14:07
  • 1
    $\begingroup$ y[0,x_]:=4-3x; y[n_,x_]:=4-3x+0.59489439*Integrate[x(1-t)(D[y[n-1,t],{t,2}]-3/2 y[n-1,t]^2),{t,0,x}]+0.594894*Integrate[x(1-t)(D[y[n-1,t],{t,2}]-3/2 y[n-1,t]^2),{t,x,1}]; Table[{n,x,y[n,x]},{n,1,3},{x,.1,1,.1}] Test that very carefully to see if it is correct. $\endgroup$ – Bill Aug 18 at 5:21
0
$\begingroup$

Here an approach to solve the problem using NestList

sol = NestList[
Function[y,FunctionInterpolation[4 - 3 x +  
0.59489439*Integrate[t (1 - x) (D[y[ t], {t, 2}] - 3/2 y[ t]^2), {t, 0, x}] + 
0.594894*Integrate[x (1 - t) (D[y[ t], {t, 2}] - 3/2 y[ t]^2), {t, x, 1}], {x, 0,1 }]    
] (* Ende Function *)
, 4 - 3 #   &  (* Startwert *)
, 10]

The iterated solutions swap between two fixpoint functions, one of them 4-3x

Plot[Through[sol [x]], {x, 0, 1}, Evaluated -> True]

enter image description here

$\endgroup$
  • $\begingroup$ Sir, but I didn't get output $\endgroup$ – Thenmozhi S Aug 18 at 19:03
  • $\begingroup$ Sorry, I edited my answer (initial condition double & was wrong) $\endgroup$ – Ulrich Neumann Aug 18 at 19:14
  • $\begingroup$ I'm a beginner to Mathematica, so that I'm having lot of doubts and doing mistakes while writing the code. Please help me to correct it $\endgroup$ – Thenmozhi S Aug 18 at 19:21
  • $\begingroup$ Try to copy my code and run it. You only have to check the equations(I don't know the background). $\endgroup$ – Ulrich Neumann Aug 18 at 19:24
  • $\begingroup$ Yes sir, I did the same, but didn't get the answer $\endgroup$ – Thenmozhi S Aug 18 at 19:26
0
$\begingroup$

There is an exact solution that coincides with the numerical solution @UlrichNeumann at the first iterations:

y[0] = 4 - 3 t; $Assumptions = a > 0 && b > 0; Table[
 y[n] = With[{y = y[n - 1]}, 
   4 - 3 x + 
    a*Integrate[
      t (1 - x) (D[y /. x -> t, {t, 2}] - 3/2 (y /. x -> t)^2), {t, 0,
        x}] + b*
     Integrate[
      x (1 - t) (D[(y /. x -> t), {t, 2}] - 3/2 (y /. x -> t)^2), {t, 
       x, 1}]], {n, 1, 3}]

Here we get a very long expression even at the third iteration. Compare y[n]and numerical solution of the equation obtained by Ulrich Neumann

Plot[Evaluate[
  Table[y[n] /. {a -> 0.59489439, b -> 0.594894}, {n, 1, 3}]], {x, 0, 
  1}, PlotLegends -> Automatic]
sol = NestList[
   Function[y, 
    FunctionInterpolation[
     4 - 3 x + 
      0.59489439*
       Integrate[
        t (1 - x) (D[y[t], {t, 2}] - 3/2 y[t]^2), {t, 0, x}] + 
      0.594894*
       Integrate[
        x (1 - t) (D[y[t], {t, 2}] - 3/2 y[t]^2), {t, x, 1}], {x, 0, 
      1}]] (*Ende Function*), 4 - 3 # &  (*Startwert*), 4];

Table[Plot[{y[i] /. {a -> 0.59489439, b -> 0.594894}, 
   sol[[i + 1]][x]}, {x, 0, 1}, PlotLabel -> i], {i, 1, 3}]

Figure 1 From the discussion it became clear that the author wanted to solve the equation y''[t]==(3/2)y[t]^2 with boundary conditions BCs={ y[0]==4, y[1]==1}. This problem has an exact solution y=4/(1+t)^2. But then the iterative scheme was built incorrectly. To build a converging process, we need to put in my scheme

y[0] = 4 - 3 x; $Assumptions = a > 0 && b > 0; Table[
 y[n] = With[{y = y[n - 1]}, 
   y + a*Integrate[
      t (1 - x) (D[y /. x -> t, {t, 2}] - 3/2 (y /. x -> t)^2), {t, 0,
        x}] + b*
     Integrate[
      x (1 - t) (D[(y /. x -> t), {t, 2}] - 3/2 (y /. x -> t)^2), {t, 
       x, 1}]], {n, 1, 3}]

We can optimize the parameters a, b using the exact solution

FindMinimum[
 Sum[(y[1] - 4/(1 + x)^2)^2, {x, 0, 1, .1}], {{a, .59}, {b, .59}}]

(*{0.00051333, {a -> 0.556396, b -> 0.653769}}*)

Let's check how different the solution at each iteration is from the exact solution

Table[Plot[(y[i] /. {a -> 0.5563963697722774`, 
      b -> 0.6537687187362005`}) - 4/(1 + x)^2, {x, 0, 1}, 
  PlotLabel -> i], {i, 1, 3}]

Figure 2

We see that with optimized parameters the process converges quite quickly. Change the numerical scheme @UlrichNeumann using non-optimized parameters

sol = NestList[
   Function[y, 
    FunctionInterpolation[
     y[x] + 0.59489439*
       Integrate[
        t (1 - x) (D[y[t], {t, 2}] - 3/2 y[t]^2), {t, 0, x}] + 
      0.594894*
       Integrate[
        x (1 - t) (D[y[t], {t, 2}] - 3/2 y[t]^2), {t, x, 1}], {x, 0, 
      1}]] (*Ende Function*), 4 - 3 # &  (*Startwert*), 4];

and compare with the exact solution

Table[Plot[(sol[[i]][x]) - 4/(1 + x)^2, {x, 0, 1}, 
  PlotLabel -> i], {i, 2, 4}]

Figure 3

We see that with non-optimized parameters the process converges worse (but converges!). Change the parameters to the optimal ones. We see that the process apparently converges and stops after the third iteration

    sol1 = NestList[
   Function[y, 
    FunctionInterpolation[
     y[x] + 0.5563963697722774`*
       Integrate[
        t (1 - x) (D[y[t], {t, 2}] - 3/2 y[t]^2), {t, 0, x}] + 
      0.6537687187362005`*
       Integrate[
        x (1 - t) (D[y[t], {t, 2}] - 3/2 y[t]^2), {t, x, 1}], {x, 0, 
      1}]] (*Ende Function*), 4 - 3 # &  (*Startwert*), 7];

Table[Plot[(sol1[[i]][x]) - 4/(1 + x)^2, {x, 0, 1}, 
  PlotLabel -> i], {i, 2, 7}]

Figure 4 A numerical solution with nonoptimized parameters behaves similarly Figure 5

$\endgroup$
  • $\begingroup$ Thank you sir, other than graph, for the table of numerical values up to 20 or 30 iterations which code can we use? $\endgroup$ – Thenmozhi S Aug 20 at 6:24
  • $\begingroup$ @ThenmozhiS First, what do you want to get? Secondly, what equation do you want to solve? You should describe the problem in mathematical language. We decided on the equation at our discretion. Do a and b really have such values in your equation? $\endgroup$ – Alex Trounev Aug 20 at 7:50
  • $\begingroup$ While solving the second order boundary value problem y''[t]=(3/2)y[t]^2 with BCs: y[0]=4, y[1]=1 by using Fixed point iterative scheme(2 step), we obtain the above mentioned volterra integral equation. In that scheme a sequence (a_n) appeared, for optimum value for a_n, it taken as 0.59... In the above eqution a=b=a_n $\endgroup$ – Thenmozhi S Aug 20 at 13:55
  • $\begingroup$ @ThenmozhiS Boundary value problem y''[t]==(3/2)y[t]^2 with BCs={ y[0]==4, y[1]==1} has exact solution y=4/(1+t)^2. $\endgroup$ – Alex Trounev Aug 20 at 15:17
  • $\begingroup$ yes sir, but we are trying to apply fixed point iteration scheme to obtain solution for higher order boundary value problem(I got this idea somewhere else). $\endgroup$ – Thenmozhi S Aug 20 at 16:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.