
#1
Feb2012, 01:32 PM

P: 11

Hello everyone!
I have a system of equations which I am trying to solve in order to 13 dependent variables. Yet, I am only interested in the answers which are real positives. In my code I have implemented a way to select only the answer which satisfies this constraint:
I know that FindRoot is able to speed up this process, but I want to search for a global (not local) solution. Is there any way to speed up this process? Thanks so much 



#2
Feb2012, 02:21 PM

PF Gold
P: 162

So are you varying the independent variables in some loop for example using Table? If so the easy answer to your question is that you can speed up the process a bit by using ParallelTable.
Another thing that you could try is the following. Say there is just 1 independent parameter x (this could be modified for more but just to illustrate my point) and say you wanna vary it over a range from 0 to 1, by discretizing this interval and checking the solution at each discrete point. Schematically you could do it like this: 0  .........  .........  ......... ........1 Each . represents a solution using FindRoot, and each  represents a solution using NSolve. Every time you're trying to do a FindRoot, for the initial guess you use the solution from the point to the left (this could be a FindRoot solution, or an NSolve solution). Because x changes only slightly from each point to the next, and presumably the solutions will maybe depend smoothly on x you shouldn't lose any roots this way. If you do lose some roots, this should be apparent the next time you get to a  point. 



#3
Feb2212, 04:25 AM

P: 11

kai_sikorski: thanks for your reply!
My objective is just to get the numerical solution to the system of equations by manually assigning values for an independent variable. Say that the independent variable x varies between 1*^10 and 1*^5. In this range, I'm considering ~200 values for x , and then finding the solution to the system of equations. Your suggestion is a very interesting idea! The issue is that, for each of the 200 values that I attribute to the independent variable, I will have to give a different operating point to the 13 dependent variables. And although I have an idea of the operating points of those dependent variables for the first x value, I have no idea what those operating points may be when I consider other values of x. Nevertheless, I will try to do what you suggested and see if what I get makes sense :) 



#4
Feb2212, 10:36 AM

PF Gold
P: 162

Mathematica: speeding up NSolve 



#5
Feb2212, 10:55 AM

P: 11





#6
Mar1912, 10:32 AM

P: 11

Ok, so I setup a function that uses FindRoot to solve the system. I also added a few checkpoints along the run, where the operating points are results taken from a NDSolve command.
Results: Before: System had 10 dependent variables. It took around 5 hours to find solutions to those variables for <100 values of an independent variable. Now: System has ~15 dependent variables. Takes less than 1 minute to find solution for about 1000 values of an independent variable. Thanks again for the help, it was very valuable! 


Register to reply 
Related Discussions  
Mathematica  sorting NSolve solutions  Math & Science Software  52  
NSolve to matlab?  Math & Science Software  0  
speeding car  Advanced Physics Homework  3  
speeding car  Brain Teasers  14  
speeding up?  Introductory Physics Homework  2 