Ok, this should be a simple problem, but for some reason it is taking me far too long to solve, and I'd like to see if anyone could help me towards the solution. I hope I've put this in the correct section.

So...

I have a set of nonlinear equations, which I'm trying to linearise about some equilibrium condition. I could do this analytically, but I since the equations are pretty complicated, I would like to computationally calculate them first as a starting point so I can at least get some preliminary results, and then I have a result to aim for when I do form the analytical solution.

My equations can be written in this form...

$\displaystyle \dot{x_1} = f_1(x_1,x_2,x_3...)$

$\displaystyle \dot{x_2} = f_2(x_1,x_2,x_3...)$

$\displaystyle \dot{x_3} = f_3(x_1,x_2,x_3...)$

and so on. Or, in short hand

$\displaystyle \dot{x} = f(x,t)$

where $\displaystyle x$ is the full vector of all the equations I'm solving. I can obtain an equilibrium condition, $\displaystyle x_0$ and $\displaystyle \dot{x}_0$, and then linearise the equation to

$\displaystyle \Delta\dot{x} = A\Delta x$, where $\displaystyle \Delta x$ is a perturbation to the system, i.e., $\displaystyle x = \Delta x + x_0$, and $\displaystyle A$ is the matrix I'm trying to calculate, which could be written as

$\displaystyle A=\frac{\partial f}{\partial x} =

\[

\begin{bmatrix}

\frac{\partial f_1}{\partial x_1} & \frac{\partial f_1}{\partial x_2} & \cdots & \frac{\partial f_1}{\partial x_n} \\

\frac{\partial f_2}{\partial x_1} & \frac{\partial f_2}{\partial x_2} & \cdots & \frac{\partial f_2}{\partial x_n} \\

\vdots & \vdots & \ddots & \cdots \\

\frac{\partial f_n}{\partial x_1} & \frac{\partial f_n}{\partial x_2} & \cdots & \frac{\partial f_n}{\partial x_n}

\end{bmatrix}

$.

To calculate $\displaystyle A$, I am cycling through each element of the $\displaystyle x$ vector, and perturbing it by some value $\displaystyle h$. I can then calculate each column through finite elements, such that

$\displaystyle \frac{\partial f}{\partial x} = \frac{f(x_0+h)-f(x_0)}{h}$.

However...all the states that make up my $\displaystyle x$ vector are of different orders. Some are very big, and some very small. Therefore, I need to have a different value for $\displaystyle h$ depending on which row of the $\displaystyle A$ matrix I'm calculating to ensure that that row is sufficiently accurate.

Currently, I'm cycling through the whole $\displaystyle x$ vector, and just calculating the $\displaystyle

\[

\begin{bmatrix}

\frac{\partial f_i}{\partial x_1} & \frac{\partial f_i}{\partial x_2} & \cdots & \frac{\partial f_i}{\partial x_n}

\end{bmatrix}

$ row of the $\displaystyle A$ matrix with an initial estimate of $\displaystyle h$, then reducing it by an order of magnitude, and recalculating. Somehow I hope to show convergence of the new matrix and the previous one through norms of some description, and then, once the matrices are sufficiently converged, I move onto the next row. However, I don't know how to fairly compare two matrices to ensure accuracy, and to prove that the matrix is converging to the right value.

I hope that you can understand my query. Please message me if not and I can clear any misunderstandings.

Thanks for your help.