SDDSlib
|
Modified midpoint method for integrating ordinary differential equations (ODEs). More...
#include "mdb.h"
Go to the source code of this file.
Macros | |
#define | MAX_EXIT_ITERATIONS 400 |
#define | ITER_FACTOR 0.995 |
#define | TINY 1.0e-30 |
#define | MAX_N_STEP_UPS 10 |
Functions | |
void | mmid (double *yInitial, double *dydxInitial, long equations, double xInitial, double interval, long steps, double *yFinal, void(*derivs)(double *_dydx, double *_y, double _x)) |
Integrates a system of ODEs using the modified midpoint method. | |
void | mmid2 (double *y, double *dydx, long equations, double x0, double interval, long steps, double *yFinal, void(*derivs)(double *_dydx, double *_y, double _x)) |
Enhances the modified midpoint method with error correction. | |
long | mmid_odeint3_na (double *yif, void(*derivs)(double *dydx, double *y, double x), long n_eq, double *accuracy, long *accmode, double *tiny, long *misses, double *x0, double xf, double x_accuracy, double h_step, double h_max, double *h_rec, double(*exit_func)(double *dydx, double *y, double x), double exit_accuracy) |
Integrates ODEs until a condition is met or the interval is reached. | |
Modified midpoint method for integrating ordinary differential equations (ODEs).
This file implements the modified midpoint method for integrating ODEs, based on the algorithms presented in "Numerical Recipes in C" by Michael Borland (1995).
Definition in file mmid.c.
void mmid | ( | double * | yInitial, |
double * | dydxInitial, | ||
long | equations, | ||
double | xInitial, | ||
double | interval, | ||
long | steps, | ||
double * | yFinal, | ||
void(* | derivs )(double *_dydx, double *_y, double _x) ) |
Integrates a system of ODEs using the modified midpoint method.
This function performs numerical integration of a system of ordinary differential equations using the modified midpoint method. It computes the final values of the dependent variables after a specified number of steps over a given interval.
yInitial | Starting values of dependent variables. |
dydxInitial | Derivatives of the dependent variables at the initial point. |
equations | Number of equations in the system. |
xInitial | Starting value of the independent variable. |
interval | Size of the integration interval in the independent variable. |
steps | Number of steps to divide the interval into. |
yFinal | Array to store the final values of the dependent variables. |
derivs | Function pointer to compute derivatives. |
Definition at line 42 of file mmid.c.
void mmid2 | ( | double * | y, |
double * | dydx, | ||
long | equations, | ||
double | x0, | ||
double | interval, | ||
long | steps, | ||
double * | yFinal, | ||
void(* | derivs )(double *_dydx, double *_y, double _x) ) |
Enhances the modified midpoint method with error correction.
This function applies the modified midpoint method with an additional correction step to improve the accuracy of the integration. It performs integration with a specified number of steps and then refines the result by integrating with half the number of steps, combining both results to achieve higher precision.
y | Starting values of dependent variables. |
dydx | Derivatives of the dependent variables at the initial point. |
equations | Number of variables in the system. |
x0 | Starting value of the independent variable. |
interval | Size of the integration interval in the independent variable. |
steps | Number of steps to divide the interval into. |
yFinal | Array to store the final values of the dependent variables. |
derivs | Function pointer to compute derivatives. |
Definition at line 111 of file mmid.c.
long mmid_odeint3_na | ( | double * | yif, |
void(* | derivs )(double *dydx, double *y, double x), | ||
long | n_eq, | ||
double * | accuracy, | ||
long * | accmode, | ||
double * | tiny, | ||
long * | misses, | ||
double * | x0, | ||
double | xf, | ||
double | x_accuracy, | ||
double | h_step, | ||
double | h_max, | ||
double * | h_rec, | ||
double(* | exit_func )(double *dydx, double *y, double x), | ||
double | exit_accuracy ) |
Integrates ODEs until a condition is met or the interval is reached.
This function integrates a set of ordinary differential equations using the modified midpoint method until either the upper limit of the independent variable is reached or a user-supplied exit condition is satisfied (i.e., a specified function becomes zero).
yif | Initial and final values of dependent variables. |
derivs | Function pointer to compute derivatives. |
n_eq | Number of equations in the system. |
accuracy | Desired accuracy for each dependent variable. |
accmode | Desired accuracy-control mode. |
tiny | Ignored parameter. |
misses | Ignored parameter. |
x0 | Initial value of the independent variable (updated to final value). |
xf | Upper limit of integration for the independent variable. |
x_accuracy | Desired accuracy for the final value of the independent variable. |
h_step | Initial step size for integration. |
h_max | Ignored parameter. |
h_rec | Ignored parameter. |
exit_func | Function to determine when to stop integration. |
exit_accuracy | Desired accuracy for the exit condition function. |
Definition at line 173 of file mmid.c.