Solving multiple independent non linear equations

10 views (last 30 days)
Hi,
I have a large number (order of 1 Milion) of non linear equations that I want to solve simultaneously.
The equations are of the form
func(x)-(a_i*x+b_i)==0
Where func is some non linear function like sin(x) (for example) and a_i, b_i are given - these equations just calculate the intersection point of some non linear function of x with many linear functions. Note that the variable x is not the same in all equations - the equations are independent. I can provide a good approximation to the solution which can be used for initializing some algorithm.
I took a look on the documentation of fzero or fsolve but I am not sure I can use them.
My current approach is to calculate second order Taylor approximations of func and intersect the linear functions with them, but I think that this is not fast, not accurate and not elegant.
Does anybody know how to do this?
Thanks
H.

Answers (1)

Alan Weiss
Alan Weiss on 26 Feb 2014
I can think of two ways:
  1. Use fzero in a loop, solving one component at a time.
  2. Use fsolve with the following options:
'Algorithm' = 'trust-region-reflective'
'JacobPattern' = speye(n) % , where n is the number of equations you have
'PrecondBandWidth' = 0
Alan Weiss
MATLAB mathematical toolbox documentation

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!