Re: Replacement gyrations

*To*: mathgroup at smc.vnet.net*Subject*: [mg55897] Re: [mg55872] Replacement gyrations*From*: "David Park" <djmp at earthlink.net>*Date*: Sat, 9 Apr 2005 03:55:47 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

When all else fails you can do 'surgery' on expressions. Wsol = {{W11 -> (A2*x21 + A1*x32)/(L86^2*(-(x32*y21) + x21*y32)), W12 -> (A2*y21 + A1*y32)/ (-(L86^2*x32*y21) + L86^2*x21*y32), W21 -> (A2*x21 + A1*x32)/(L75^2*(-(x32*y21) + x21*y32)), W22 -> (A2*y21 + A1*y32)/(-(L75^2*x32*y21) + L75^2*x21*y32)}}; temp = MapAt[Factor, Wsol, {{1, 2, 2, 2}, {1, 4, 2, 2}}] temp = MapAt[Minus, %, {{1, 2, 2, 1}, {1, 2, 2, 4, 1}}] Wsol2 = MapAt[Minus, %, {{1, 4, 2, 1}, {1, 4, 2, 4, 1}}] {{W11 -> (A2*x21 + A1*x32)/(L86^2*((-x32)*y21 + x21*y32)), W12 -> -((A2*y21 + A1*y32)/(L86^2*(x32*y21 - x21*y32))), W21 -> (A2*x21 + A1*x32)/(L75^2*((-x32)*y21 + x21*y32)), W22 -> -((A2*y21 + A1*y32)/(L75^2*(x32*y21 - x21*y32)))}} {{W11 -> (A2*x21 + A1*x32)/(L86^2*((-x32)*y21 + x21*y32)), W12 -> (A2*y21 + A1*y32)/(L86^2*((-x32)*y21 + x21*y32)), W21 -> (A2*x21 + A1*x32)/(L75^2*((-x32)*y21 + x21*y32)), W22 -> -((A2*y21 + A1*y32)/(L75^2*(x32*y21 - x21*y32)))}} {{W11 -> (A2*x21 + A1*x32)/(L86^2*((-x32)*y21 + x21*y32)), W12 -> (A2*y21 + A1*y32)/(L86^2*((-x32)*y21 + x21*y32)), W21 -> (A2*x21 + A1*x32)/(L75^2*((-x32)*y21 + x21*y32)), W22 -> (A2*y21 + A1*y32)/(L75^2*((-x32)*y21 + x21*y32))}} First I applied Factor to the specific part that I wanted factored. Then, in the last two commands, I switched the signs of two factors. To find the positions I often 'fish' for them with the Part command. For example, Part[temp, 1, 4, 2, 4, 1] x32 y21 - x21 y32 David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: carlos at colorado.edu [mailto:carlos at colorado.edu] To: mathgroup at smc.vnet.net A Solve for 4 variables W11,W12,W21,W22 produces, after Simplify Wsol={{W11 -> (A2*x21 + A1*x32)/(L86^2*(-(x32*y21) + x21*y32)), W12 -> (A2*y21 + A1*y32)/(-(L86^2*x32*y21) + L86^2*x21*y32), W21 -> (A2*x21 + A1*x32)/(L75^2*(-(x32*y21) + x21*y32)), W22 -> (A2*y21 + A1*y32)/(-(L75^2*x32*y21) + L75^2*x21*y32)}} Question 1: why do L86^2 and L75^2 come out as a factor in two expression denominators and not in the others? Seems a random event. This uncertainty inhibits the action of further replacement rules such as (-(x32*y21) + x21*y32) -> 2*A123 which works on W11 and W21 only. Question 2: I tried Collect [Wsol,{L86,L75}] to try to force grouping of L86^2 and L75^2, but it has no effect. Do I need to say Wsol=Wsol*L86^2*L75^2, Simplify, replace and finally Wsol=Wsol/L86^2*L75^2 ? Or fool around with Numerator and Denominator?