[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octave code for y'''=0 ODE
From: |
Tatsuro MATSUOKA |
Subject: |
Re: Octave code for y'''=0 ODE |
Date: |
Tue, 28 Jul 2015 16:26:31 +0900 (JST) |
----- Original Message -----
> From: deepus
> To: help-octave
> Cc:
> Date: 2015/7/28, Tue 13:22
> Subject: Octave code for y'''=0 ODE
>
> Find the particular solution of
>
> y'''=0
>
> given that:
>
> y(0)=3, y'(1)=4, y''(2)=6
>
> How can I write the Octave code for solve the above equation?
> Please help me...
>
>
In general, to solve higher order ordinal differential equation,
the problem modified to first order simultaneous differential equations.
y1'=y2
y2'=y3
y3'=0
y1(0)=3
y2(1)=4
y3(2)=6
However
The manual of lsode states:
The set of differential equations to solve is
dx
-- = f (x, t)
dt
with
x(t_0) = x_0
The solution is returned in the matrix x, with each row corresponding to an
element of the vector t. The first element of t should be t_0 and should
correspond to the initial state of the system x_0, so that the first row of the
output is x_0.
is not case of
"The first element of t should be t_0 and should correspond to the initial
state of the system x_0, so that the first row of the output is x_0."
The above special case
y3=const, y2 changes linearly to t.
Thus
y1(0)=3
y2(0)=-2
y3(0)=6
gives correct results.
Thus
f=@(y,t)[y(2);y(3);0];
t=0:1:10;
y_0=[3 -2 6];
y=lsode(f,y_0,t);
Then
>> [t' y]
ans =
0.00000 3.00000 -2.00000 6.00000
1.00000 4.00000 4.00000 6.00000
2.00000 11.00000 10.00000 6.00000
3.00000 24.00000 16.00000 6.00000
4.00000 43.00000 22.00000 6.00000
5.00000 68.00000 28.00000 6.00000
6.00000 99.00000 34.00000 6.00000
7.00000 136.00000 40.00000 6.00000
8.00000 179.00000 46.00000 6.00000
9.00000 228.00000 52.00000 6.00000
10.00000 283.00000 58.00000 6.00000
But the above is rare case.
However I do not know general way to set the initial dependent variables depend
on different t_0 values.
Perhaps much experts for ode will give solutions.
Tatsuro