# Solving 4 variable system of equations

Trying to solve a systems of equations. Here's the code:

alphaIndoor=1.46172*10^6
alphaOutdoor=1.61956*10^7
priceTap=977.554
alphaField=2.41546*10^7
alphaVeg=547723.

FindInstance[(qIndoor/alphaIndoor)^(-1/0.3) - (qOutdoor/alphaOutdoor)^(-1/0.75) == 0 &&
(qOutdoor/alphaOutdoor)^(-1/0.75) - priceTap - (qField/alphaField)^(-1/1.5) + 30 == 0 &&
(qField/alphaField)^(-1/1.5) - (qVeg/alphaVeg)^(-1/0.5) == 0 &&
qIndoor + qOutdoor + qField + qVeg == 400000,
{qIndoor, qOutdoor, qField, qVeg}, Reals]


I've already given values to everything except the variables I'm asking it to solve for {qIndoor, qOutdoor, qField, qVeg}.

The program doesn't solve the problem, but just runs forever. Any help would be much appreciated!

• the value of priceTap is not provided in your post. – kglr Oct 19 '14 at 23:13
• Yea just added it. Thanks for the keen eye! – Mike Oct 19 '14 at 23:17
• Do you have any additional constraints you could add, such as qIndoor > 0, qOutdoor > 0, etc? Also, try solving the first equation to get qOutdoor as a function of qIndoor, and substitute into the second equation, etc. This piecemeal solution may work better. – user1722 Oct 19 '14 at 23:48

Since qIndoor + qOutdoor + qField + qVeg == 400000 there are only three independent variables

alphaIndoor = 1.46172*10^6;
alphaOutdoor = 1.61956*10^7;
priceTap = 977.554;
alphaField = 2.41546*10^7;
alphaVeg = 547723;

eqns = {(qIndoor/alphaIndoor)^(-10/3) -
(qOutdoor/alphaOutdoor)^(-4/3) == 0,
(qOutdoor/alphaOutdoor)^(-4/3) - priceTap -
(qField/alphaField)^(-2/3) + 30 == 0,
(qField/alphaField)^(-2/3) -
(qVeg/alphaVeg)^-2 == 0} /.
qVeg -> 400000 - (qIndoor + qOutdoor + qField);

sol = Join[fr = FindRoot[eqns,
{{qIndoor, 18*^4}, {qOutdoor, 9*^4}, {qField, 55*^3}}],
{qVeg -> (400000 - (qIndoor + qOutdoor + qField) /. fr)}]


{qIndoor -> 183688., qOutdoor -> 90664.9, qField -> 54019.7, qVeg -> 71627.3}

Show[
ContourPlot3D[Evaluate[eqns],
{qIndoor, 0, 4*^5}, {qOutdoor, 0, 4*^5}, {qField, 0, 4*^5},
RegionFunction -> ((#1 + #2 + #3) < 4*^5 &),
ContourStyle -> Opacity[.5],
AxesLabel -> (Style[#, 14, Bold] & /@
{qIndoor, qOutdoor, qField}),
PlotPoints -> 25],
Graphics3D[{Red, AbsolutePointSize,
Point[{qIndoor, qOutdoor, qField} /. sol]}]] FindRoot[{(qIndoor/alphaIndoor)^(-1/0.3) - (qOutdoor/
alphaOutdoor)^(-1/0.75) == 0, (qOutdoor/alphaOutdoor)^(-1/0.75) -
priceTap - (qField/alphaField)^(-1/1.5) + 30 == 0,
(qField/alphaField)^(-1/1.5) - (qVeg/alphaVeg)^(-1/0.5) == 0,
qIndoor + qOutdoor + qField + qVeg == 400000}, {{qIndoor,100},
{qOutdoor, 100}, {qField, 100}, {qVeg, 100}}]
{qIndoor -> 183688., qOutdoor -> 90664.9, qField -> 54019.7,
qVeg -> 71627.3}
(*{qIndoor -> 183688., qOutdoor -> 90664.9, qField -> 54019.7, qVeg -> 71627.3}*)

• This is a better approach than using NSolve...which did not produce an outcome – thils Oct 20 '14 at 0:08