[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Solving a First Order ODE system using GSL
From: |
Warren Weckesser |
Subject: |
Re: [Help-gsl] Solving a First Order ODE system using GSL |
Date: |
Tue, 10 Nov 2009 21:59:40 -0600 |
You can treat your equation as a system that happens to have just one
dimension, and implement it the same way you would an n-dimensional system.
I have attached code that solves the Solow equation (from economics); it is
basically the same as the example in the reference manual, but modified for
this first order equation. The jacobian is just the derivative of the
right-hand side of the equation with respect to the dependent variable (x,
in your case; k, for the Solow model).
Warren
On Tue, Nov 10, 2009 at 12:09 PM, Earl, Joseph <address@hidden
> wrote:
> Hi,
>
> I am trying to solve a first-order ODE of the form
>
> x' = sqrt(1/3x - k + lx^2)
>
> using the GSL C++ library, where k and l are constants for a particular
> solution.
>
> I have no problem at all using GSL to solve 2nd order (such as x'' = -x)
> and higher ODEs, something is just confusing about the first order equations
> and how to put them into the required form.
> The Jacobian doesn't seem to make much sense with a 1st order ODE.
>
> Also the current documentation is pretty poor - there is only one example
> of a 2nd order ODE which is repeated all over the net. So if anyone wants to
> add a 1st order example to the help docs I'm sure that would be of some use
> to others (and me!) in the future.
>
> Any help would be much appreciated (if you feel like writing out a full
> working example that would be awesome).
>
> Regards,
> Joseph Earl
> Imperial College London
>
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl
>
gsl_1d_ode.c
Description: Binary data