Determine derivatives using computer system

37 Views Asked by At

I've got an ODE of the form

$\frac{d}{dt} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} x_2 \\ c - x_1^2 \end{bmatrix}$

where $c$ is some constant. I want to write an augmented state matrix

$\begin{bmatrix} y_1 \\ y_2 \\ y_3 \\ y_4 \\ \vdots \end{bmatrix} = \begin{bmatrix} x_1 \\ x_2 \\ x_1^2 \\ x_2x_1 \\ \vdots \end{bmatrix}$

Where

$\frac{d}{dt} y_1 = x_2$

$\frac{d}{dt}y_2 = c - x_1^2$

$\frac{d}{dt}y_3 = \frac{d}{dt}x_1^2 = 2x_1\frac{d}{dt}x_1 = 2x_1x_2$

and so on such that I get a "closed" representation of the system with my variables $y_k$. This goes on, and what I want to do is truncate, say at the first $k$ terms, and analytically evaluate the derivatives using a computer system.

How can I implement this? Thanks!