[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] problem
From: |
caoj |
Subject: |
Re: [Help-gsl] problem |
Date: |
Wed, 24 Aug 2005 12:55:11 -0500 |
User-agent: |
Internet Messaging Program (IMP) 3.2-cvs |
Thanks a lot. Attached is my function.
Jun Cao
Quoting Pau Cervera Badia <address@hidden>:
> I think it means that gsl_odeiv_evolve_apply is trying to adjust h to
> obtain the prescribed presicion in the integration of the equations, but
> the step-size value seems too large to obtain that precision, so the
> routine chooses a smaller step (see [1]). It seems like if one or more
> of your variables or derivatives is unboundedly growing, so your
> solutions are diverging, but I'm not sure if it is the only reason
> because I don't know you're equations.
>
> Maybe you can post your *func* function and we can take a look.
>
> [1] http://www.gnu.org/software/gsl/manual/gsl-ref_25.html#SEC384
>
> address@hidden wrote:
>
> >Hi Pau Cervera Badia:
> >
> >I check h. I found that h is becoming smaller and smaller and finally get to
>
> >0.0. What does it mean? Does it mean my program is wrong? Thanks again.
> >
> >Jun Cao
> >
> >
> >Quoting Pau Cervera Badia <address@hidden>:
> >
> >
> >
> >>Maybe is changing only a little.
> >>Can you monitor the h values, something as
> >>
> >>while (t < t1) {
> >>
> >> int status = gsl_odeiv_evolve_apply(e,c,s,&sys,&t,t1,&h,y);
> >>
> >> printf("%.5e %.5e %.5e\n", t, t1, h);
> >>
> >> if (status != GSL_SUCCESS)
> >> break;
> >>
> >>}
> >>
> >>will do. If h is becoming smaller and smaller, something wrong is
> happening
> >>(maybe your ecuations are diverging somewhere).
> >>
> >>
> >>address@hidden wrote:
> >>
> >>
> >>
> >>>Hi Pau Cervera Badia:
> >>>
> >>>Thank you for your response. I check my program again. It stuck in
> >>>
> >>>
> >>t=5.790250,
> >>
> >>
> >>>t1=6.467000. After gsl_odeiv_evolve_apply, t always is 5.790250 and does
> >>>
> >>>
> >>not
> >>
> >>
> >>>change. So the program stuck in the "while" loop. I try to change h to
> 1e-2
> >>>
> >>>
> >>and
> >>
> >>
> >>>1e-10. I get the same result. Do you have anoter idea? Thanks again.
> >>>
> >>>Jun Cao
> >>>
> >>>
> >>>Quoting Pau Cervera Badia <address@hidden>:
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>gsl_odeiv_evolve_apply(e,c,s,&sys,&t,t1,&h,y) will advance from time t
> >>>>to the next integration time with an optimum step-size, provided that
> >>>>the next time is less than t1. Otherwise it will integrate the system to
>
> >>>>t1 exactly. So after some iterations the while condition will be false.
> >>>>
> >>>>You can check that gsl_odeiv_evolve_apply is running properly with:
> >>>>
> >>>>while (t < t1) {
> >>>>
> >>>> int status = gsl_odeiv_evolve_apply(e,c,s,&sys,&t,t1,&h,y);
> >>>>
> >>>> printf("%.5e %.5e\n", t, t1); // this should print t less than t1
> >>>>
> >>>> if (status != GSL_SUCCESS)
> >>>> break;
> >>>>
> >>>>}
> >>>>printf("%.5e %.5e\n",t,t1); // this should print t equal to t1
> >>>>
> >>>>If I'm not missing something, your program should work. Maybe the
> >>>>problem is that t is always less than t1 for some other reason (maybe
> >>>>the routine couldn't reach the prescribed precision and
> >>>>gsl_odeiv_evolve_apply is trying to reduce the step-size more and more).
>
> >>>>Maybe you can check the h values.
> >>>>
> >>>>Maybe something will be of any help.
> >>>>
> >>>>address@hidden wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Hi:
> >>>>>
> >>>>>I use ordinary differential equations from GSL. The part of my program
> is
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>like
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>example shown in the document.
> >>>>>
> >>>>>const gsl_odeiv_step_type * T
> >>>>> = gsl_odeiv_step_rk8pd;
> >>>>>
> >>>>>gsl_odeiv_step * s
> >>>>> = gsl_odeiv_step_alloc (T, 9);
> >>>>>gsl_odeiv_control * c
> >>>>> = gsl_odeiv_control_y_new (1e-6, 0.0);
> >>>>>gsl_odeiv_evolve * e
> >>>>> = gsl_odeiv_evolve_alloc (9);
> >>>>>
> >>>>>double mu = 10;
> >>>>>gsl_odeiv_system sys = {func, NULL, 9, &mu};
> >>>>>
> >>>>>double t = 0.0;
> >>>>>double h = 1e-6;
> >>>>>
> >>>>>for (i = 1; i <no_of_data_points; i++) {
> >>>>> t1 = mytable[i];
> >>>>> while (t < t1)
> >>>>> {
> >>>>> int status = gsl_odeiv_evolve_apply (e, c, s,
> >>>>> &sys,
> >>>>> &t, t1,
> >>>>> &h, y);
> >>>>>
> >>>>> if (status != GSL_SUCCESS)
> >>>>> break;
> >>>>> }
> >>>>> ...
> >>>>> }
> >>>>>gsl_odeiv_evolve_free (e);
> >>>>>gsl_odeiv_control_free (c);
> >>>>>gsl_odeiv_step_free (s);
> >>>>>
> >>>>>The weird thing is that at some i, the program stuck inside of "while"
> >>>>>
> >>>>>
> >>loop
> >>
> >>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>and
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>never come out. gsl_odeiv_evolve_apply will give t=t, so t is always <
> >>>>>
> >>>>>
> >>t1.
> >>
> >>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>As
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>result the program never stop. Dose anyone know how to solve this
> problem?
> >>>>>
> >>>>>
> >>>>>Thanks.
> >>>>>
> >>>>>Jun Cao
> >>>>>
> >>>>>
> >>>>>
> >>>>>_______________________________________________
> >>>>>Help-gsl mailing list
> >>>>>address@hidden
> >>>>>http://lists.gnu.org/mailman/listinfo/help-gsl
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>--
> >>>>Pau Cervera i Badia (e-mail address@hidden)
> >>>>{
> >>>> Departament de Física Fonamental Martí i Franqués, 1
> >>>> Universitat de Barcelona Planta 3, despatx 346 bis
> >>>> 08028 Barcelona
> >>>> tel: +34 934 921 155 Spain
> >>>>
> >>>> "To err is human, but to really foul things up requires a computer."
> >>>>}
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>--
> >>Pau Cervera i Badia (e-mail address@hidden)
> >>{
> >> Departament de Física Fonamental Martí i Franqués, 1
> >> Universitat de Barcelona Planta 3, despatx 346 bis
> >> 08028 Barcelona
> >> tel: +34 934 921 155 Spain
> >>
> >> "To err is human, but to really foul things up requires a computer."
> >>}
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >
> >
> >
>
> --
> Pau Cervera i Badia (e-mail address@hidden)
> {
> Departament de Física Fonamental Martí i Franqués, 1
> Universitat de Barcelona Planta 3, despatx 346 bis
> 08028 Barcelona
> tel: +34 934 921 155 Spain
>
> "To err is human, but to really foul things up requires a computer."
> }
>
>
>
ode_fcn.c
Description: Text document
- [Help-gsl] problem, caoj, 2005/08/24
- Re: [Help-gsl] problem, Pau Cervera Badia, 2005/08/24
- Re: [Help-gsl] problem, caoj, 2005/08/24
- Re: [Help-gsl] problem, Pau Cervera Badia, 2005/08/24
- Re: [Help-gsl] problem, caoj, 2005/08/24
- Re: [Help-gsl] problem, Pau Cervera Badia, 2005/08/24
- Re: [Help-gsl] problem,
caoj <=
- Re: [Help-gsl] problem, Pau Cervera Badia, 2005/08/24
- Re: [Help-gsl] problem, Paul Schneider, 2005/08/24
- Re: [Help-gsl] problem, Tommy Nordgren, 2005/08/25
- Re: [Help-gsl] problem, caoj, 2005/08/25
- Re: [Help-gsl] problem, Tommy Nordgren, 2005/08/24