Re: How can I solve these simultaneous quadratic equations in Mathemetica?
- To: mathgroup at smc.vnet.net
- Subject: [mg65776] Re: How can I solve these simultaneous quadratic equations in Mathemetica?
- From: bghiggins at ucdavis.edu
- Date: Mon, 17 Apr 2006 02:28:20 -0400 (EDT)
- References: <e1stfp$bf5$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Helsnam, One way to at least get a sense of what the real roots look like is to use FindRoot. We define the equations to be a function of c eqnSet[c_] := {1 + 3c/2 + x( 1 + c + y + z - x) + c*y + (y + z + x)/2 - w(2y + 2x - 3w + 3 + 2c) == 0, c/2 + w(y + z - w + 3/2 + c) - x( 2w + 2z - 3x + 2) == 0, 1 + 2c + w(1 + c) + z(w + x - z + 3/2 + c) - y(2w + 2z - 3y + 4 + 2c) == 0, y(x + w - y + 1 + c) - c(1 + w) + (y + w - x)/2 - z(2y + 2x - 3z) == 0}; Then use FindRoot to solve for the roots for a given value of C. Here are the roots when C=2.8 sol1=FindRoot[eqnSet[28/10],{x,2},{y,2},{ z,2},{w,2},WorkingPrecision->34,MaxIterations->10000] {x -> -51.53066781230369784213550192724105, y -> -29.11808168180036045675199024633007, z -> -26.97039854525144908482676830076015, w -> -51.48887061457502546060305006442841} Of course, the downside of using FindRoot is that different initial guesses for the roots will lead to other solutions (if they exist). Using NSolve gives all the roots. Here is a way to extract the real roots from NSolve: Cases[NSolve[eqnSet[2.8]], {Rule[_, _Real] ...}, 8] {{z -> -94.1726, y -> -85.6825, x -> -171.641, w -> -167.993}, { z -> -26.9704, y -> -29.1181, x -> -51.5307, w -> -51.4889}, { z -> -4.55878, y -> -3.28643, x -> -5.09562, w -> -4.03022}} Note for certain values of c there may be no real roots e.g. c=1. You can also explore the behavior of a root by plotting it as a function of c Here is how x varies with c in the range 0<c<0.99 ListPlot[Table[Flatten[{c, x /. Cases[NSolve[ eqnSet[c]], { Rule[_, _Real] ...}, 8]}], {c, 0, 0.99, 0.05}], PlotJoined -> True] Hope this helps, Brian