libnum:examples:gear
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| libnum:examples:gear [2026/03/04 14:46] – abc | libnum:examples:gear [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Integration of Systems of Linear Differential Equations ====== | ||
| - | Gear Method.\\ | ||
| - | Let's examine the following //SLDE//: | ||
| - | y₁′ = y₂ | ||
| - | y₂′ = y₁ | ||
| - | y₁(0)=0 | ||
| - | NB: we expect // | ||
| - | |||
| - | < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include " | ||
| - | |||
| - | using namespace NumericMethods; | ||
| - | |||
| - | bool derfun1(int n, double x, const double y[], double dy[]) | ||
| - | { | ||
| - | dy[0] = y[1]; | ||
| - | dy[1] = -y[0]; | ||
| - | return true; | ||
| - | } | ||
| - | |||
| - | bool jacobian1(int n, double x, const double y[], double j[]) | ||
| - | { | ||
| - | j[0] = 0; j[1] = 1; j[2] = -1; j[3] = 0; | ||
| - | return true; | ||
| - | } | ||
| - | |||
| - | bool my_print1(const GearEngineContext& | ||
| - | |||
| - | int main() | ||
| - | { | ||
| - | | ||
| - | | ||
| - | |||
| - | Gear solver; | ||
| - | | ||
| - | |||
| - | | ||
| - | | ||
| - | | ||
| - | |||
| - | | ||
| - | | ||
| - | |||
| - | try | ||
| - | { | ||
| - | Message rc=solver.solve(0, | ||
| - | printf(" | ||
| - | assistant.statistics.steps, | ||
| - | assistant.statistics.jacCalls); | ||
| - | } | ||
| - | | ||
| - | { | ||
| - | | ||
| - | } | ||
| - | | ||
| - | } | ||
| - | |||
| - | bool my_print1(const GearEngineContext& | ||
| - | { | ||
| - | | ||
| - | // print y values and their derivatives | ||
| - | int n = context.n; | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | } | ||
| - | </ | ||
libnum/examples/gear.1772624818.txt.gz · Last modified: by abc
