Re: imposing side conditions on Solve
- To: mathgroup at smc.vnet.net
- Subject: [mg24051] Re: [mg24029] imposing side conditions on Solve
- From: BobHanlon at aol.com
- Date: Wed, 21 Jun 2000 02:20:11 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 6/20/2000 3:42:07 AM, amaydeu at tinet.fut.es writes: >I have two questions for the group on using Solve. > >1) How do I impose conditions on the solution? Consider the following >example > > >omega1 = {l1^2 + ps1, l1*l2, l2^2 + ps2, l1*l3, l2*l3, l3^2 + ps3, >l1*l4, l2*l4, l3*l4, > l4^2 + ps4}; >theta1 = {l1, l2, l3, l4, ps1, ps2, ps3, ps4}; >omega2 = {e1^2*(ll1^2 + pp1), e1*e2*ll1*ll2, e2^2*(ll2^2 + pp2), >e1*e3*ll1*ll3, e2*e3*ll2*ll3, > e3^2*(ll3^2 + pp3), e1*e4*ll1*ll4, e2*e4*ll2*ll4, e3*e4*ll3*ll4, >e4^2*(ll4^2 + pp4)}; >theta2 = {ll1, ll2, ll3, ll4, pp1, pp2, pp3, pp4}; > >sol = Solve[omega1 == omega2, theta1] > >omega2 ==Simplify[omega1/.Flatten[sol[[1]]]] > >So it works. However, how do I impose the condition that all elements of >theta1 must be positive? > >2) Why Solve fails to say that there is no solution to this problem? > >omega1={1 + ps1, 1, 1 + ps2, 1, 1, 1 + ps3, 1, 1, 1, 1 + ps4}; >theta1={ps1, ps2, ps3, ps4}; >omega2={e1^2*(1 + pp1), e1*e2, e2^2*(1 + pp2), e1*e3, e2*e3, e3^2*(1 + >pp3), e1*e4, e2*e4, e3*e4, > e4^2*(1 + pp4)}; >theta2={pp1, pp2, pp3, pp4}; >sol = Solve[omega1 == omega2, theta1] > >omega2 == Simplify[omega1/.sol[[1]]] > omega1 = {l1^2 + ps1, l1*l2, l2^2 + ps2, l1*l3, l2*l3, l3^2 + ps3, l1*l4, l2*l4, l3*l4, l4^2 + ps4}; theta1 = {l1, l2, l3, l4, ps1, ps2, ps3, ps4}; omega2 = {e1^2*(ll1^2 + pp1), e1*e2*ll1*ll2, e2^2*(ll2^2 + pp2), e1*e3*ll1*ll3, e2*e3*ll2*ll3, e3^2*(ll3^2 + pp3), e1*e4*ll1*ll4, e2*e4*ll2*ll4, e3*e4*ll3*ll4, e4^2*(ll4^2 + pp4)}; theta2 = {ll1, ll2, ll3, ll4, pp1, pp2, pp3, pp4}; sol = Solve[Thread[omega1 == omega2], theta1]; And @@ Flatten[Thread[omega1 == omega2] /. sol // Simplify] True Assuming that the variables are real, then the conditions for the elements of theta1 to be positive are (And @@ (# > 0 & /@ (theta1 /. sol[[1]]))) /. (x_^2 * y_ > 0) :> (y > 0) -e1*ll1 > 0 && -e2*ll2 > 0 && -e3*ll3 > 0 && -e4*ll4 > 0 && pp1 > 0 && pp2 > 0 && pp3 > 0 && pp4 > 0 The second problem has a solution; however, it requires specific values for e1, e2, e3, and e4 omega1 = {1 + ps1, 1, 1 + ps2, 1, 1, 1 + ps3, 1, 1, 1, 1 + ps4}; theta1 = {ps1, ps2, ps3, ps4}; omega2 = {e1^2*(1 + pp1), e1*e2, e2^2*(1 + pp2), e1*e3, e2*e3, e3^2*(1 + pp3), e1*e4, e2*e4, e3*e4, e4^2*(1 + pp4)}; theta2 = {pp1, pp2, pp3, pp4}; (sol = Solve[Thread[omega1 == omega2], Join[theta1, {e1, e2, e3, e4}]]) // ColumnForm {ps1 -> pp1, ps2 -> pp2, ps3 -> pp3, ps4 -> pp4, e1 -> -1, e2 -> -1, e3 -> -1, e4 -> -1} {ps1 -> pp1, ps2 -> pp2, ps3 -> pp3, ps4 -> pp4, e1 -> 1, e2 -> 1, e3 -> 1, e4 -> 1} And @@ Flatten[Thread[omega1 == omega2] /. sol] True The conditions for the elements of theta1 to be positive are Union[(And @@ (# > 0 & /@ theta1)) /. sol] {pp1 > 0 && pp2 > 0 && pp3 > 0 && pp4 > 0} Bob Hanlon