I’m trying to solve a system of two non-linear equations with two variables.
I understand I can use the NLsolve package, but I was wondering if there is any dimension I can improve to get faster speed.
Suppose I have two non-linear equations, F(x,y) and G(x,y), which are functions of the variables x and y.
The first equation is given by the expression 0 = -k + F(x,y)[mid], where F(x,y)[mid] corresponds to the value of the middle grid of the iterated value function. For the second equation, I know only that it is very complicated and not necessarily smooth.
When I use the nlsolve function, the trust region method is three times slower than the Anderson method. Even the Anderson method seems quite slow, so I thought I could exploit more of the first equation.
What I have in mind is to collect solutions of the first equation and then plug them one by one into the second equation and verify if it’s true or not.
Would there be any way to do the first step to collect every combination that satisfies the first equation?
Other than what I’ve proposed, is there any better way to handle this problem?
Any suggestion would be greatly helpful.