help with equation

classic Classic list List threaded Threaded
3 messages Options
lan
Reply | Threaded
Open this post in threaded view
|

help with equation

lan
Hi, everyone!
Thank you for your attention.
I got to solve numerically higly non-linear equation and get the following error.
I use Octave 3.6.3 and lsode seemingly is the only included ode.
Best wishes, lan
 

function xdot = f (x, t);
ep=0.000001;
si=-1;
a=2;
C=100;
xdot = [x(2), -ep/si*(-a*x(1)^(a-1)+C+2*si/t*tanh(x(2)/ep))*cosh(x(2)/ep)^2]';
endfunction
x0 = [100; 1]';
t = linspace(1, 12, 10000)';
lsode_options ("integration method", "stiff")
x = lsode ("f", x0, t);
plot(x(:,1), t);
print -deps R.ep

LSODE-- WARNING..INTERNAL T (=R1) AND H (=R2) ARE
SUCH THAT IN THE MACHINE, T + H = T ON THE NEXT STEP
(H = STEP SIZE). SOLVER WILL CONTINUE ANYWAY
In above, R1 = 0.1000000000000D+01 R2 = 0.0000000000000D+00
LSODE-- AT T (=R1) AND STEP SIZE H (=R2), THE
CORRECTOR CONVERGENCE FAILED REPEATEDLY
OR WITH ABS(H) = HMIN
In above, R1 = 0.1000000000000D+01 R2 = 0.0000000000000D+00
error: lsode: repeated convergence failures (t = 1; perhaps bad Jacobian supplied or wrong choice of integration method or tolerances)
error: called from:




_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: help with equation

Juan Pablo Carbajal
On Fri, Oct 5, 2012 at 2:23 AM, t t <[hidden email]> wrote:

> Hi, everyone!
> Thank you for your attention.
> I got to solve numerically higly non-linear equation and get the following
> error.
> I use Octave 3.6.3 and lsode seemingly is the only included ode.
> Best wishes, lan
>
>
> function xdot = f (x, t);
> ep=0.000001;
> si=-1;
> a=2;
> C=100;
> xdot = [x(2),
> -ep/si*(-a*x(1)^(a-1)+C+2*si/t*tanh(x(2)/ep))*cosh(x(2)/ep)^2]';
> endfunction
> x0 = [100; 1]';
> t = linspace(1, 12, 10000)';
> lsode_options ("integration method", "stiff")
> x = lsode ("f", x0, t);
> plot(x(:,1), t);
> print -deps R.ep
>
> LSODE-- WARNING..INTERNAL T (=R1) AND H (=R2) ARE
> SUCH THAT IN THE MACHINE, T + H = T ON THE NEXT STEP
> (H = STEP SIZE). SOLVER WILL CONTINUE ANYWAY
> In above, R1 = 0.1000000000000D+01 R2 = 0.0000000000000D+00
> LSODE-- AT T (=R1) AND STEP SIZE H (=R2), THE
> CORRECTOR CONVERGENCE FAILED REPEATEDLY
> OR WITH ABS(H) = HMIN
> In above, R1 = 0.1000000000000D+01 R2 = 0.0000000000000D+00
> error: lsode: repeated convergence failures (t = 1; perhaps bad Jacobian
> supplied or wrong choice of integration method or tolerances)
> error: called from:
>
>
>
>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave
>

hi,
You can try the following.

0. Are there singularities in the equation?
1. Provide a Jacobian.
2. Choose a suitable "integration method"' (for example "bdf").
3. Try reducing the time step.

How to do all this is explained in "help lsode" or "doc lsode".

If everything fails try the Runge-Kutta integrators in the package
odepkg available from Octave Forge. Remember, providing Jacobian will
help the integrator produce better solutions if they exist.

--
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Z├╝rich
http://ailab.ifi.uzh.ch/carbajal/
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: help with equation

c.-2

On 5 Oct 2012, at 08:42, Juan Pablo Carbajal wrote:

> hi,
> You can try the following.
>
> 0. Are there singularities in the equation?
> 1. Provide a Jacobian.
> 2. Choose a suitable "integration method"' (for example "bdf").
> 3. Try reducing the time step.
>
> How to do all this is explained in "help lsode" or "doc lsode".
>
> If everything fails try the Runge-Kutta integrators in the package
> odepkg available from Octave Forge. Remember, providing Jacobian will
> help the integrator produce better solutions if they exist.

If your equation is very stiff you might also want to try the DASPK solver instead of LSODE.
All suggestions by JP still hold if you switch to DASPK.
c.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave