Student Support Forum: 'System of non-lonear equations' topicStudent Support Forum > General > "System of non-lonear equations"

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response toen 03/31/12 01:18am Hi Max, This kind of problem typically occurs because your set of equations has no solution, i.e. there is contradictory information in your eqlist. This is why you get different values when you only consider some equations, or use algorithms to solve for only some variables: depending on which part of the contradictory information they use, they will find a different answer. However you have a mix of very large and very small values in your equations, so in your case it's probably due to numerical issues with computations. My solution follows: To see a simpler version of your problem, don't set any values (Ucdp=0, etc.) and instead set up a list of replacements: repRules={Ucdp->0,Uc6p->0,...,mFit->0.026}; This lets you use symbolic solutions rather than numeric ones - in your case the mix of very large and very small values will mess up most numerical algorithms. Then set: eqlist = Table[FullSimplify[eqlist[[i]] == 0], {i, Length[eqlist]}]; The resulting equations are linear in everything except Ucd. Trying to Solve this Solve[eqlist,varlist] hangs up my computer, so instead I leave out the 7th last term, as all other equations are linear. mathematica solves this in a flash: varlist = Table[list2[[i]], {i, Length[list2]}]; sollist = Solve[eqlist[[;; -7]]~Join~eqlist[[-6 ;;]], varlist]; Put in the numerical values (mostSols=sollist[[1]]/.repRules)//MatrixForm and you've almost got the solution, you just need the value of Il6. So solve the remaining equation: Il6sol=First@Solve[(eqlist[[-7]]//.mostSols/.repRules)//FullSimplify,Il6] allSols = (mostSols /. Il6sol)~Join~Il6sol Now you've got everything, but beware: when you solve problems in pieces like this you can miss solutions, and get weird artifacts. So it's worth substituting the values back into the equations: (eqlist /. repRules /. allSols) Clearly there's a problem, with all the "False"s. So check how much of that is due to numerical issues: {eqnLHS,eqnRHS}={eqlist[[;;,1]],eqlist[[;;,2]]}; Transpose[{eqlist}~Join~({eqnLHS,eqnRHS,eqnLHS-eqnRHS}/.allSols/.repRules)]//MatrixForm and the only problem is with equation 1: (-2 Ucd+Ucdp+2 dt Ucdx)/dt==0 note that this equation is independent of dt, so you can instead verify (-2 Ucd+Ucdp+2 dt Ucdx)==0 avoiding numerical issues with division by 10^-15: -2 Ucd + Ucdp + 2 dt Ucdx /. allSols /. repRules = -3.35832*10^-16 Now everything is good! Note that you could have left dt out of eqns 1-4 from the start. Just remember there may be other solutions that haven't been found... Hope this helps. /toen Attachment: temp_toen.nb, URL: ,

 Subject (listing for 'System of non-lonear equations') Author Date Posted System of non-lonear equations Max Sakharov 03/27/12 11:09am Re: System of non-lonear equations toen 03/31/12 01:18am Re: Re: System of non-lonear equations Max Sakharov 04/01/12 12:15pm
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic