User Tools

Site Tools


libnum:examples:gear

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
libnum:examples:gear [2026/03/04 14:06] abclibnum: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  and  y₂(0)=1 
-  # we expect sin(x)/cos(x) as the result 
- 
-<file> 
-#include <stdio.h> 
-#include <math.h> 
-#include "libnum/gear.h" 
- 
-using namespace NumericMethods; 
- 
-{ 
- double initValues[] = { 0, 1, 0, 0}; 
- GearUserProc uf1(diffun1), uf2(j1); 
- 
- Gear solver; 
- solver.set(2, &uf1, &uf2); // task dimention is 2 
- GearAssistant& assistant = solver.assistant; 
- assistant.params.setParameter("HINI", 0.0001);  // starting step of integration  
- assistant.params.setParameter("EPS", 0.001);    // step error constant  
- 
- GearEngineCallbackEmbed printHandler(my_print); 
- solver.setCallback(printHandler); 
- 
- try 
- { 
-  Message rc=solver.solve(0, 5, initValues);     // integrate for t from 0 to 5 
- } 
- catch(Message e) {} 
-} 
-</file> 
  
libnum/examples/gear.1772622402.txt.gz · Last modified: by abc