We present a program to solve by a numerical scheme a system of
first-order linear differential equations of the form
A2y'' + A1y' + A0y = f
where the matrices A0 and A1 and
A2 are
| 2 -1 | | -2 0 | | 2 0 |
A0 = | |, A1 = | |, A2 = | |
| -1 2 | | 0 1 | | 0 1 |
and
| (2-2π2)sin(πt) - 2πcos(πt) - cos(2πt) |
f = | |.
| (2-4π2)cos(2πt) - 2πsin(2πt) - sin(πt) |
With adapted initial conditions, the solution is given by
y1(t) = sin(πt), y2 = cos(2πt)
- After initializing the global variables theFinalTime and theTimeStep, we declare an instance of class
ODESolver,
where we have chosen the Newmark scheme with default parameters, and
set the number of equations to 2.
ODESolver ode(NEWMARK,theTimeStep,theFinalTime,2);
|