2

I am trying to work on a problem with a probability distribution. I wanted to get the result in analytical form. Suppose I need to keep p1, p2, p3, p4 variables such that p1+p2+p3+p4=1;

How to use this information (p1+p2+p3+p4=1) in mathematica so that wherever in my calculation this term appears, it takes the value 1. Otherwise I will have to find this expression in a lengthy result and convert.

kphy
  • 35
  • 5

1 Answers1

3

You could use explicit assumptions:

Assuming[p1 + p2 + p3 + p4 == 1, Simplify[Exp[p1 + p2 + 3 p3 + p4 + 3]]]

(* Out: E^(4 + 2 p3) *)
MarcoB
  • 67,153
  • 18
  • 91
  • 189
  • okay, it works. Thanks – kphy Jun 07 '15 at 17:27
  • @KunalSharma One can also set $Assumptions = p1 + p2 + p3 + p4 == 1. It is equivalent to Assuming, except that Assuming temporarily sets $Assumptions and setting $Assumptions will remain in effect for computations until it is reset ($Assumptions = True). Sometimes one form (Assuming vs $Assumptions) is more convenient than the other. Also note that only some functions, such as Simplify, use $Assumptions. – Michael E2 Jun 07 '15 at 17:33
  • @KunalSharma if the solution I proposed worked for you, you might consider accepting my answer. You can do so by clicking on the checkmark next to it in the left margin. Thank you! – MarcoB Jun 08 '15 at 23:02