3
$\begingroup$

I am new to Mathematica and am afraid this is a silly question. I have this very easy substitution, it has three equations on three unknowns {w1, l1, t1}. I want to substitute the first two equations into the the third one, so that everything is in terms of w1 and then solve for w1. In pen and paper this is simple. I have tried many ways to do this with mathematica but Solve just stalls. Any suggestions as to how I could isolate w1?

Equations

l1w1optlag = Flatten[Solve[MRSw1andl1 == 0, l1]]
{l1 -> (pw^2 w1)/((1 + a e1)^2 w^2)}
t1w1optlag = Flatten[Solve[MRSw1andt1 == 0, t1]] 
{t1 -> (pw^2 w1)/((1 + a e1)^2 r^2)}
focwrtlam == 0
1 - (Sqrt[l1]/d + Sqrt[t1]/d + Sqrt[w1]/d)^2 == 0

All I want to do is plug the first two equations on the the third one and solve for w1. Notice that I am getting rules for the first two equations. I have tried converting these rules to equations or evaluating the third expression with these rules and solving it as follows but it doesn't work:

Solve[focwrtlam == 0 /.t1w1optlag /.l1w1optlag,w1]
$\endgroup$
  • $\begingroup$ (1 - (Sqrt[l1]/d + Sqrt[t1]/d + Sqrt[w1]/d)^2 == 0) /. {l1 -> (pw^2 w1)/((1 + a e1)^2 w^2), t1 -> (pw^2 w1)/((1 + a e1)^2 r^2)} $\endgroup$ – ciao Mar 30 '15 at 6:04
  • $\begingroup$ If I ask Mathematica to isolate w1 it cant handle the job it stalls. How can I isolate w1 after evaluating the third expression with the other two? $\endgroup$ – Goose Mar 30 '15 at 6:08
  • $\begingroup$ Solve first two for {l1, t1} and plug solution(s) into third. $\endgroup$ – Daniel Lichtblau Mar 30 '15 at 14:32
2
$\begingroup$

Your equation is easier to handle if it put into an equivalent form.

eq1 = Sqrt[l1] + Sqrt[t1] + Sqrt[w1] == d;

It is also to convenient to write the rules as

r1 = {l1 -> (pw^2 w1)/((1 + a e1)^2 w^2)};
r2 = {t1 -> (pw^2 w1)/((1 + a e1)^2 r^2)};

and substitute u^2 for w1 getting a new equation

eq2 = eq1 /. Join[r1, r2] /. w1 -> u^2
Sqrt[u^2] + Sqrt[(pw^2 u^2)/((1 + a e1)^2 r^2)] + 
  Sqrt[(pw^2 u^2)/((1 + a e1)^2 w^2)] == d

This can be simplified

 eq3 = Simplify[eq2, Assumptions -> {u > 0}]
d == u (1 + Sqrt[pw^2/(r + a e1 r)^2] + Sqrt[pw^2/(w + a e1 w)^2])

Solving is now trivial.

soln = Solve[eq3, u][[1]] // Simplify
{u -> d/(1 + Sqrt[pw^2/(r + a e1 r)^2] + Sqrt[pw^2/(w + a e1 w)^2])}

Finally, to get w1 it is only necessary to evaluate u^2.

w1 = u^2 /. soln; w1
d^2/(1 + Sqrt[pw^2/(r + a e1 r)^2] + Sqrt[pw^2/(w + a e1 w)^2])^2
$\endgroup$
  • $\begingroup$ Thank you, was not aware of the Join[] function. $\endgroup$ – Goose Mar 30 '15 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.