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.


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...
\dot{x_1} = f_1(x_1,x_2,x_3...)
\dot{x_2} = f_2(x_1,x_2,x_3...)
\dot{x_3} = f_3(x_1,x_2,x_3...)
and so on. Or, in short hand
\dot{x} = f(x,t)
where x is the full vector of all the equations I'm solving. I can obtain an equilibrium condition, x_0 and \dot{x}_0, and then linearise the equation to
\Delta\dot{x} = A\Delta x, where \Delta x is a perturbation to the system, i.e., x = \Delta x + x_0, and A is the matrix I'm trying to calculate, which could be written as
A=\frac{\partial f}{\partial x} = <br />
\[<br />
\begin{bmatrix}<br />
\frac{\partial f_1}{\partial x_1} & \frac{\partial f_1}{\partial x_2} & \cdots & \frac{\partial f_1}{\partial x_n} \\<br />
\frac{\partial f_2}{\partial x_1} & \frac{\partial f_2}{\partial x_2} & \cdots & \frac{\partial f_2}{\partial x_n} \\<br />
\vdots & \vdots & \ddots & \cdots \\<br />
\frac{\partial f_n}{\partial x_1} & \frac{\partial f_n}{\partial x_2} & \cdots & \frac{\partial f_n}{\partial x_n}<br />
\end{bmatrix}<br />

To calculate A, I am cycling through each element of the x vector, and perturbing it by some value h. I can then calculate each column through finite elements, such that
\frac{\partial f}{\partial x} = \frac{f(x_0+h)-f(x_0)}{h}.

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

Currently, I'm cycling through the whole x vector, and just calculating the <br />
\[<br />
\begin{bmatrix}<br />
\frac{\partial f_i}{\partial x_1} & \frac{\partial f_i}{\partial x_2} & \cdots & \frac{\partial f_i}{\partial x_n}<br />
\end{bmatrix}<br />
row of the A matrix with an initial estimate of 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.