# Conditional Summations

I am not a math major, but for a networking class, I am taking I am required to do summations for probability. I know the logic but I don't know the mathematical theory to make this work. Using Wolfram I'm trying to do this

sum [(35 choose n)* (100*j)*(.1^n* .9^(35-n))] from n=0 to 35, if[n>10, j=10, j=n]


Essentially, what I'm asking is: How do I run a summation with a variable that is affected by an if statement in this way? Or is there a different math I should be using.

Edit: Sorry for not being clear. I am trying to do this in Wolfram Alpha. I did not realize there was a difference.

• I'm voting to close this question as off-topic because questions concerning Wolfram|Alpha are specifically excluded from this site – m_goldberg Sep 18 '18 at 20:32
• Okay, I am sorry. I did not realize – Edward Domka Sep 18 '18 at 20:35

Sum[Binomial[35, n]*100*If[n > 10, 10, n]*(.1^n*.9^(35 - n)), {n, 0, 35}]

• Thank you so much! I'm used to programming, I couldn't fully grasp how the if statements worked. I tried looking here but was confused by all the high level stuff. This is perfect. Thank you so much edit: Wolfram didn't understand – Edward Domka Sep 18 '18 at 18:33
Sum[Binomial[35,n]100*Min[10,n]*.1^n*.9^(35-n), {n,0,35}]


349.946

Nested If statements work well in Mathematica, but Wolfram|Alpha seems to have some issues with them. However, in this case using Min to grab the minimum of n and 10 achieves the appropriate behavior.

• So if I am understanding correctly. That reads "minimum n, maximum 10"? – Edward Domka Sep 18 '18 at 19:10
• Min[10,n] is "the smaller of 10 and n". Or, "n, but no more than 10". – eyorble Sep 18 '18 at 19:11

You can also get Expectation of transformed random variable y = 100 Min[10, x] where x is a random variable with distribution BinomialDistribution[35, .1]:

Expectation[100 Min[10, x], Distributed[x, BinomialDistribution[35, .1]]]


349.94631523961846

Alternatively,

td = TransformedDistribution[100 Min[10, x], Distributed[x,BinomialDistribution[35, .1]]];
Expectation[y, Distributed[y, td]]


349.94631523961846

Another way

Sum[Binomial[35,n]100 j .1^n .9^(35-n)/.{j:>10/;n>10,j:>n/;n<=10},{n,0,35}]


349.946

• I can't get this to work in Wolfram Alpha either. Am i doing something wrong? – Edward Domka Sep 18 '18 at 18:41
• If you are trying to evaluate this sum using Wolfram|Alpha and not Wolfram Mathematica, I would edit your post to make that explicitly clear (though I can see where the confusion comes from). – That Gravity Guy Sep 18 '18 at 18:55
• Okay, I will. Sorry, I thought they used the same code. That's why I tagged it Wolfram-alpha-queries. I'm new to this – Edward Domka Sep 18 '18 at 18:56