1

Is there a way to simplify the following equation

 (-p(a-x)((a-b)P(b-x)+Q(b+x)(a-b+2x))+q(a+x)(-(a-b)Q(b+x)+P(b-x)(-a +b+2x)))/((b-x)(-a + x)(a+x)(b+x))

assuming

 {p+q == 1, P + Q == 1}

in order to get

q/(-a + x) - p/(a + x) - Q/(-b + x) + P/(b + x)

? Although FullSimplify works in this case when I am using instead of p,q,P,Q variables with subscripts according to the following substitution:

{p -> Subscript[A,1], q -> Subscript[B,1], P -> Subscript[A,2], Q -> Subscript[B,2],a-> Subscript[a,1],b-> Subscript[a,2]}

FullSimplify ceases to produce the desired result! This is pretty unexpected behaviour!

yarchik
  • 18,202
  • 2
  • 28
  • 66
  • 1
    FullSimplify with assumptions works here, but gives different result than You give. What do You mean by "Simplify with assumptions does not work"? You don't get any output, errors or what? – Wojciech Jan 11 '14 at 21:27
  • FullSimplify[(-p (a - x) ((a - b) P (b - x) + Q (b + x) (a - b + 2 x)) + q (a + x) (-(a - b) Q (b + x) + P (b - x) (-a + b + 2 x)))/((b - x) (-a + x) (a + x) (b + x)), Assumptions -> {p + q == 1, P + Q == 1}] gives the correct answer, although as Wokciech said, it is a slightly different, but nevertheless equivalent expression. – DumpsterDoofus Jan 11 '14 at 21:43
  • @Wojciech: I formulated it wrong, it works, but does not produce a desired result ! – yarchik Jan 11 '14 at 22:19
  • @yarchik If it doesn't produce a desired result, then what does it produce? When I type FullSimplify[(-p (a - x) ((a - b) P (b - x) + Q (b + x) (a - b + 2 x)) + q (a + x) (-(a - b) Q (b + x) + P (b - x) (-a + b + 2 x)))/((b - x) (-a + x) (a + x) (b + x)), {p + q == 1, P + Q == 1}] /. {p -> Subscript[A, 1], q -> Subscript[B, 1], P -> Subscript[A, 2], Q -> Subscript[B, 2]} I get the same result I would get without ReplaceAll, of course with p,q,P,Q instead of A1,A2,B1,B2. – Wojciech Jan 11 '14 at 22:37
  • By the way, the result I get is 1/(b + x) + (-1 + B1)/( a + x) +B1/(-a + x) + (2 x B2)/(b^2 - x^2) – Wojciech Jan 11 '14 at 22:41
  • @Wojciech: I ment in the different order. It seems these operations are not commutative. Let us first substitute p,q,P,Q with subscripted variables and then try to simplify... – yarchik Jan 11 '14 at 22:42
  • @yarchik so You would like the same result, but in different order? Why would it be in that particular order and not a different one? – Wojciech Jan 11 '14 at 22:44
  • For me the order of manipulation, not of result presentation is important: I would like in the original equation to use subscripted variables and still be able to FullSimplify as you suggested in your original comment. – yarchik Jan 11 '14 at 22:46

1 Answers1

1

Try this one

This is your expression

f1 = (-p (a - x) ((a - b) P (b - x) + Q (b + x) (a - b + 2 x)) + 
 q (a + x) (-(a - b) Q (b + x) + P (b - x) (-a + b + 2 x)))/((b - 
   x) (-a + x) (a + x) (b + x));

We define a substitution rule

rule = {(p + q) -> 1, (P + Q) -> 1};

which in combination with FullSimplify

f2 = FullSimplify[f1] /. rule

gives a slightly modified result from that you want which however, is equivalent.

Q/(b - x) + q/(-a + x) - p/(a + x) + P/(b + x)
Vaggelis_Z
  • 8,740
  • 6
  • 34
  • 79
  • First of all thanks a lot for the prompt answer! It is funny, but I am still not completely satisfied. I my calculations I am using another symbols for constants. They are different from those that appear in this question. Let us try to reproduce this scenario: f4=f1/.{p -> Subscript[A, 1], q -> Subscript[B, 1], P -> Subscript[A, 2], Q -> Subscript[B, 2]}, and the same for the rule: rule2={Subscript[A, 1] + Subscript[B, 1] -> 1, Subscript[A, 2] + Subscript[B, 2] -> 1}. I am wondering why in this case your method does not work! – yarchik Jan 11 '14 at 22:14