Finding the root of a set of coupled non-linear equations in Python

31 Views Asked by At

I am trying to solve a symplectic mapping problem and for that I need to evaluate the following non-linear equation:

enter image description here

In this case, I need to find the values of xi_{n+1} which make the left and the right hand side equal.

However, the problem is that the function H consists of taking partial derivatives with respect to the unknown variables xi_{n+1}. This is how the H function is specified:

enter image description here

This means that I need a non-linear solver which can couple the underlying equations for the gradient expression in H.

I have tried using fsolve from scipy in combination with the numerical evaluation of the gradient via the gradient function found within numpy.

This approach works for really small number of points. However, once I try to increase the number of points for which the updated xi_{n+1} need to be computed, fsolve just does not work anymore (at least the computation takes a significant amount of time).

I have tried using other nonlinear solvers from scipy but non of them really helped me in solving this issue.

Right now I have found a work-around in which I iterate over each point and find the updated xi_{n+1} coordinate but I would like to have an approach in which I can couple the expressions from adjacent points together, i.e, to solve the complete system simultaneously.

Any thoughts on how could I achieve this?

0

There are 0 best solutions below