Example 2.81

Check solution to the original IVP:

sol=DSolve[{ y'[t]==t^2+y[t]^2,y[1]==2},y[t],t]

Beautiful solution, with many Bessel functions.

y[t_]=y[t]/.First[sol];

plot1=Plot[y[t],{t,0,2},PlotRange->{Automatic,{-5,5}}]

Example 2.8.7

Here is a differential equation, which we solve using Mathematica:

Clear[f,y]
f[t_,y_] = t*y+1; 
sol=DSolve[{y'[t]==f[t,y[t]],y[0]==0},y[t],t]

The function above is called the Error Function, another beautiful function.

y[t_]=sol[[1,1,2]]

solplot=Plot[y[t],{t,0,4},PlotStyle->{Dashing[{0.02,0.02}],Red},ImageSize->{400,Automatic},AxesLabel->{"x","y"}]

Now, let's use Picard's iteration method to generate approximations to the solution.

Clear[ϕ]
num=4;
ϕ[0] := 0;
ϕ[n_]:=ϕ[n] =  Integrate[f[t,ϕ[n-1]],{t,0,t}];

Table[{n,ϕ[n]},{n,0,num}];
TableForm[%]
funclist = Table[ϕ[n],{n,0,num}];
Plot[Evaluate[funclist],{t,0,6},DisplayFunction->Identity]
Show[solplot,%,ImageSize->{400,Automatic},PlotRange->{Automatic,{0,24}},DisplayFunction->$DisplayFunction]

The iterates do appear to be converging to the function. Each iterate satisfies the initial condition but not the differential equation.

Example 2.8.14

Let's just do some numerical experimntation to see if the result in this problem is true.

ϕ[x_,n_]=2*n*x*Exp[-n*x^2]

Manipulate[Plot[ϕ[x,n],{x,0,1},PlotRange->{{0,1},{0,70}}],{n,10,5000,50}]

It seems to be getter closer to zero over the entire interval, but something funny is happening as we get closer to zero (the peak gets larger). We see that in the limit as we go to infinity, the function actually is zero over the entire interval.

Integrate[ϕ[x,n],{x,0,1}]

Limit[%,n->Infinity]

This is the kind of problem you might see in an Analysis class.