Using the Levenberg-Marquardt to solve a set of non-linear equations #1039
-
|
I would like to use the Levenberg-Marquardt to solve a set of non linear equations. As an example: The above can be written as two functions to be minimized f(1) = x - y + 1 = 0 I have read the source codes: And I have also searched the tests files, however, I am not sure how to formulate the code to use the minimizer. While the above equations are analytical and their Jacobian can be easily computed, my final goal is to simply use the objective function with a set of guess values to find the solution of the equations. Any help on this will be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
|
[EDIT] I've revised the comment to express the Levenberg-Marquardt method and its underlying assumptions more clearly.
For your optimization, assume that the measured values, represented by the Y vectors, are zeros, and consider the following model values: // model:
// f(x; a, b) = f1^2 + f2^2 = (a - b + 1)^2 + (a^2 - b + 1)^2
// derivatives:
// df/da = 4 a^3 + a (6 - 4 b) - 2 b + 2
// df/db = -2 (a^2 + a - 2 b + 2)Please note that the results may vary depending on the initial guess. |
Beta Was this translation helpful? Give feedback.
-
|
Sample code: |
Beta Was this translation helpful? Give feedback.
-
|
As a follow up, I was able to:
Here is the full code |
Beta Was this translation helpful? Give feedback.
[EDIT] I've revised the comment to express the Levenberg-Marquardt method and its underlying assumptions more clearly.
Rosenbrock_LM_Der()orRosenbrock_LM_Dif()can be of assistance. As you know, the Levenberg-Marquardt method seeks to determine parameters that minimize the squared difference between the model and the measured values.For your optimization, assume that the measured values, represented by the Y vectors, are zeros, and consider the following model values:
Please note that the results may vary d…