help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] problem


From: Tommy Nordgren
Subject: Re: [Help-gsl] problem
Date: Wed, 24 Aug 2005 20:37:36 +0200


Aug 24, 2005 kl. 5:43 AM skrev address@hidden:

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

Are you experiencing a STIFF differential equation set? Stiffness is when the equations have multiple solutions with vastly different characteristic lenght scales. With some solvers such as RungeKutta, it will be necessary to follow the diffeqn on the lenght scale of the fastest variying solution, there are other methods necessary to handle such problems. Consult the litterature on the topic. For example consider the function A exp(-x) + B exp (- 10000 x), The second term causes any error in the solution to be multiplied by a large factor,
when trying to solve the equation numerically.
The stepping methods gsl_odeiv_step_bsimp, gsl_step_gear1, and gsl_step_gear2 can handle stiff problems, I think


"How will the German Government be able to abolish Nuclear Power? I don't know. I guess they will have to do as the German Government did during the thirties and forties: Use Gas!"
Tommy Nordgren
address@hidden







reply via email to

[Prev in Thread] Current Thread [Next in Thread]