This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ODE example


ok here is the example of the code i am using to solve lane emden

a user can define their own
"ode_func_to_integrate"

and, then call either
ode_rungekutta_adaptivestep_out
OR
ode_rungekutta_adaptivestep_in

this code reproduction could be solved, but i am on a hectic schedule and it 
works for me this way so i havnt minimised it. the out function is for steps 
of increasing t, and in, is for steps of decreasing t.

the values passed to the functions are starting points for y and dy/dx, 
where to start the step and end it, step size and i left space for an 
additional parameter if anyone wants to use it (this example, lane-emden 
does not need an additional parameter)

example calls are (using the function in the source that follows);
---START---
// For OUT
double xstep=0.00001;
double initialx =0.0;
double endx = 3.65376;
double initialdvdx = 1.0;
double initialv = 0.0;
ode_rungekutta_adaptivestep_out
	(initialv,
	initialdvdx,
	initialx,
	endx,
	xstep,
	0);
// For IN
double initialdvdx;
double initialx = 3.6537537;
double endx = 0.0;
double initialv = 0.0;
double initialdvdx = -0.742812826;
xstep = DBL_EPSILON - xstep;
ode_rungekutta_adaptivestep_in
	(initialv,
	initialdvdx,
	initialx,
	endx,
	xstep,
	0);
---END

hope this helps somebody,
cheers
Sam
---
"Anyone can play guitar", Radiohead, 1993

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

Attachment: lanerungekutta.c
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]