5
The relationship between pressure (\(P\)), volume (\(V\)), and temperature (\(T\)) is modeled as:
We need to find the parameters \(a\) and \(b\) that minimize the sum of squared residuals between the measured data and the model.
Model:
Residual:
Jacobian entries:
So each row of the Jacobian matrix \( J \) is:
Then LM forms:
Your original code likely used first-order gradient descent (\( a \leftarrow a - \eta \frac{\partial J}{\partial a} \) , \( b \leftarrow b - \eta \frac{\partial J}{\partial b} \)). The Levenberg-Marquardt (LM) version instead solves, at each iteration:
Then updates the parameter vector \( \theta = \begin{bmatrix} a \\ b \end{bmatrix} \):
Your model is highly nonlinear in \( b \) because of the term:
This can become stiff when \( b \) gets close to the smallest volume. LM is usually much more stable than plain gradient descent because it uses local curvature information through \( J^T J \), while still damping risky steps.
Subtle point: Strictly speaking, classical LM often uses \( J^T J + \lambda \text{diag}(J^T J) \). The code below uses the simpler and common form with \( I \), which is still a valid LM-style implementation.
So:
• small \( \lambda \rightarrow \) behaves more like Gauss-Newton
• large \( \lambda \rightarrow \) behaves more like cautious gradient descent
That is the key LM idea.