3
$\begingroup$

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.

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

4 Answers 4

6
$\begingroup$
Sum[Binomial[35, n]*100*If[n > 10, 10, n]*(.1^n*.9^(35 - n)), {n, 0, 35}]
$\endgroup$
1
  • $\begingroup$ 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 $\endgroup$ Commented Sep 18, 2018 at 18:33
3
$\begingroup$
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.

$\endgroup$
2
  • $\begingroup$ So if I am understanding correctly. That reads "minimum n, maximum 10"? $\endgroup$ Commented Sep 18, 2018 at 19:10
  • $\begingroup$ Min[10,n] is "the smaller of 10 and n". Or, "n, but no more than 10". $\endgroup$
    – eyorble
    Commented Sep 18, 2018 at 19:11
3
$\begingroup$

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

$\endgroup$
1
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ I can't get this to work in Wolfram Alpha either. Am i doing something wrong? $\endgroup$ Commented Sep 18, 2018 at 18:41
  • 1
    $\begingroup$ 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). $\endgroup$ Commented Sep 18, 2018 at 18:55
  • $\begingroup$ 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 $\endgroup$ Commented Sep 18, 2018 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.