Hi everyone,
I am trying to solve an ode like this:
diff(y(x),x,x)=-(1+0.2*cos(x))*sinh(y(x))+0.3*cosh(y(x)),
the only boundary condition I want to impose is y(0)=y(2*Pi),Dy(0)=Dy(2*Pi). Anybody knows about it? Thanks!
Waiting for more experienced users to share their thoughts, I will try an approximation:
The differential equation with the boundary conditions comprise a nonlinear boundary value problem (a BVP refers to a situation where the auxiliary conditions are specified at more than one value of the independent variable). I don’t know if Maple has got a built-in routine to solve boundary value problems (maybe others know better), but a way to solve (numerically) such a system is to discretize the derivatives using finite difference formulas (this is not the best way: collocation methods are better, but not simple). For example, using m intervals (so that you have m+1 node points) the second derivative will be (f[i+1]-2*f[i]+f[i-1])/h^2, where h=1/m, and f=y.
The first condition becomes: f[1]-f[m+1] (=0). For the second boundary condition you need first order finite differences: (-f[m+1]+4*f[m]-3*f[m-1])/(2*h)+(f[3]-4*f[2]-3*f[1])/(2*h) (=0).
Eventually, the finite difference scheme might be [with x=(i-1)*h] in Maple notation:
Provided that the above analysis is flawless, you may notice some things.
1. The differential equation became a system of m+1 algebraic equations. f[1] is y(0) and f[m+1] is y(2*Pi).
2. For values of m larger than 20, Maple cannot return a solution. Then you need to define a range for f[1], that is f[1]=0..0.02 in the fsolve command.
3. The plot becomes smoother for larger values of m, but at the expense of computational time.
4. The set of algebraic equations might have more than one solutions. For example, for m=4, f[1]=f[5]=4.0059, but also f[1]=f[5]=0.053. I don’t know what this means for your problem.
An approximation (?)
Waiting for more experienced users to share their thoughts, I will try an approximation:
The differential equation with the boundary conditions comprise a nonlinear boundary value problem (a BVP refers to a situation where the auxiliary conditions are specified at more than one value of the independent variable). I don’t know if Maple has got a built-in routine to solve boundary value problems (maybe others know better), but a way to solve (numerically) such a system is to discretize the derivatives using finite difference formulas (this is not the best way: collocation methods are better, but not simple). For example, using m intervals (so that you have m+1 node points) the second derivative will be (f[i+1]-2*f[i]+f[i-1])/h^2, where h=1/m, and f=y.
The first condition becomes: f[1]-f[m+1] (=0). For the second boundary condition you need first order finite differences: (-f[m+1]+4*f[m]-3*f[m-1])/(2*h)+(f[3]-4*f[2]-3*f[1])/(2*h) (=0).
Eventually, the finite difference scheme might be [with x=(i-1)*h] in Maple notation:
> restart: m:=10: h:=1/m: s1:=fsolve({seq((f[i+1]-2*f[i]+f[i-1])/h^2-(1+0.2*cos((i-1)*h)*sinh(f[i])+0.3*cosh(f[i])), i=2..m),f[1]-f[m+1],-f[m+1]+4*f[m]-3*f[m-1]+f[3]-4*f[2]-3*f[1]},{seq(f[i],i=1..m+1)});
> Solutions:=subs(s1,[seq(f[i],i=1..m+1)]):
f:=[seq(op(i,Solutions),i=1..m+1)];
Note that you need to define a different range in order to print a plot:
> points:=[seq([2*Pi*i/(m+1),f[i]],i=1..m+1)]; plot(points);
Provided that the above analysis is flawless, you may notice some things.
1. The differential equation became a system of m+1 algebraic equations. f[1] is y(0) and f[m+1] is y(2*Pi).
2. For values of m larger than 20, Maple cannot return a solution. Then you need to define a range for f[1], that is f[1]=0..0.02 in the fsolve command.
3. The plot becomes smoother for larger values of m, but at the expense of computational time.
4. The set of algebraic equations might have more than one solutions. For example, for m=4, f[1]=f[5]=4.0059, but also f[1]=f[5]=0.053. I don’t know what this means for your problem.
pantole
Correction
In the previous post, the points command should read: points:=[seq([2*Pi*(i-1)/m,f[i]],i=1..m+1)];
Sorry. I hope this is the only mistake.
pantole
Thanks a lot! I am trying
Thanks a lot! I am trying that.
-Rick
Boundary Value Problems
If you are using Maple 10, these help pages ?BVP and ?dsolve/numeric/BVP might be useful.
Good luck,
J. Tarr