help-gsl
[Top][All Lists]
Advanced

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

[Help-gsl] gsl-1.15 odeiv2: symbol lookup error for gsl_odeiv2_step_type


From: Benjamin Trendelkamp-Schroer
Subject: [Help-gsl] gsl-1.15 odeiv2: symbol lookup error for gsl_odeiv2_step_type
Date: Sun, 12 Jun 2011 19:15:42 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10

Hi,

I have only recently started to use gsl and wanted to try the new odeiv2 functions. I have successfully compiled and built gsl-1.15 on my Ubuntu system. My source code is basically a copy of the example code in the ordinary differential equation section of the html documentation.

   #include <stdio.h>
   #include <gsl/gsl_math.h>
   #include <gsl/gsl_errno.h>
   #include <gsl/gsl_matrix.h>
   #include <gsl/gsl_odeiv2.h>

   int func (double t, const double y[], double dydt[], void *params)
   {
       dydt[0]=y[1];
       dydt[1]=-1.0*sin(y[0]);
       return GSL_SUCCESS;
   }

   int jac (double t, const double y[], double *dfdy, double dfdt[],
   void *params)
   {
       gsl_matrix_view dfdy_mat=gsl_matrix_view_array(dfdy, 2, 2);
       gsl_matrix *m = &dfdy_mat.matrix;
       gsl_matrix_set(m, 0, 0, 0.0);
       gsl_matrix_set(m, 0, 1, 1.0);
       gsl_matrix_set(m, 1, 0, -1.0*cos(y[0]));
       gsl_matrix_set(m, 1, 1, 0.0);
       dfdt[0]=0.0;
       dfdt[1]=0.0;
       return GSL_SUCCESS;
   }
   int main(void)
   {
       gsl_odeiv2_system odesys = {func, jac, 2};
       gsl_odeiv2_driver *d =
             gsl_odeiv2_driver_alloc_y_new (&odesys, gsl_odeiv2_step_rk4,
                                            1e-3, 1e-8, 1e-8);

           double t = 0.0;
           double y[2] = { 1.0, 0.0 };
           int i, s;

           for (i = 0; i < 100; i++)
             {
               s = gsl_odeiv2_driver_apply_fixed_step (d, &t, 1e-3,
   1000, y);

               if (s != GSL_SUCCESS)
                 {
                   printf ("error: driver returned %d\n", s);
                   break;
                 }

               printf ("%.5e %.5e %.5e\n", t, y[0], y[1]);
             }

           gsl_odeiv2_driver_free (d);
           return 0;
   }

Compiling and linking went smoothly but upon execution I got the following error message:

   gsl_odeint: symbol lookup error: ./gsl_odeint: undefined symbol:
   gsl_odeiv2_step_rk4

I guess I have just made a mistake somewhere but I can't figure it out. I'd be glad for any suggestion.

Thanks,

Benjamin


reply via email to

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