I will do some calculations with probability distribution p[t] - which is a vector and each term corresponds to a probability of some event. Accordingly the sum over the terms in p[t] has to be one, for all times t. I have tried to implement it in such a way

p[t_] := {p0[t], p1[t], p2[t], p3[t]}; 
$Assumptions = Total[p[_]] == 1;
$Assumptions = p[_] \[Element] PositiveReals

But it doesn't work, as

In[275]:= Simplify[Total[p[_]]]

Out[275]= p0[_] + p1[_] + p2[_] + p3[_]

In[276]:= Simplify[Total[p[7]]]

Out[276]= p0[7] + p1[7] + p2[7] + p3[7]

And I would expect 1 as the output, in both cases. Thanks the comments I know that the problem is the second assumption, which "delate" the first one. How can I include many global assumptions in the different parts of my notebook (as I have many assumptions concerning different things which are defined at different places)?

  • $\begingroup$ Refine[Total[p[7]], Total[p[_]] == 1] works for me and gives 1. Also for Simplify. $\endgroup$ – Alx Jul 19 '19 at 11:37
  • $\begingroup$ But how can I set Total[p[_]] = 1 everywhere, in the whole notebook? $\endgroup$ – Agnieszka Jul 19 '19 at 12:06
  • $\begingroup$ I checked with fresh starded Mathematica, all your commands work for me and give 1 as expected. $\endgroup$ – Alx Jul 19 '19 at 12:15
  • $\begingroup$ I have used Clear["Global`*"] and run it once again and have still the same problem. I have Mathematica 12.0.0 $\endgroup$ – Agnieszka Jul 19 '19 at 12:18
  • $\begingroup$ Clear["Global*"]` does not remove $Assumptions. Save your nb and Quit Kernel, then start Local Kernel again, and check commands. I did this and all is working. $\endgroup$ – Alx Jul 19 '19 at 12:35

You can append new assumptions to $Assumptions using AppendTo:

p[t_] := {p0[t], p1[t], p2[t], p3[t]}; 

$Assumptions = {Total[p[_]] == 1};
AppendTo[$Assumptions , p[_] ∈ PositiveReals];






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.