# Expectation over Poisson distribution

I ran into a problem calculating the following expectation value:

smin = -6.; ds = 0.1; c = 6;
Expectation[x/c*e^((smin + (counter - 1)*ds)*x/c), x ≈ PoissonDistribution[c]]


It seems that Mathematica gets stuck for the value counter = 10, and I don't understand why. Could someone help?

• I can get the generic Expectation[x/c Exp[a + b x /c], x \[Distributed] PoissonDistribution[n]]. – b.gates.you.know.what Feb 22 '17 at 14:56
• How is that possible? On my laptop it doesn't work! – Francesco Coghi Feb 22 '17 at 15:09
• Is it possible that you need \[Distributed] instead of ≈ ? (as @b.gatessucks suggests). Using that works for me on both versions 11.01 and 10.4.1 on Windows 7. – JimB Feb 22 '17 at 18:05
• I don't think so, with Normal distribution works with ≈ – Francesco Coghi Feb 23 '17 at 8:29

$Version (* "11.0.1 for Mac OS X x86 (64-bit) (September 21, 2016)" *) smin = -6; ds = 1/10; c = 6; counter = 10;  As a workaround, you can either use NExpectation NExpectation[x/c*E^((smin + (counter - 1)*ds)*x/c), x \[Distributed] PoissonDistribution[c]] (* 0.0137666 *)  Or take the Mean of the TransformedDistribution Mean@TransformedDistribution[x/c*E^((smin + (counter - 1)*ds)*x/c), x \[Distributed] PoissonDistribution[c]] (* E^(-(137/20) + 6/E^(17/20)) *) % // N (* 0.0137666 *)  EDIT: Works on an earlier version $Version

(*  "10.4.1 for Mac OS X x86 (64-bit) (April 11, 2016)"  *)

smin = -6; ds = 1/10; c = 6; counter = 10;

Expectation[x/c*E^((smin + (counter - 1)*ds)*x/c),
x \[Distributed] PoissonDistribution[c]]

(*  E^(-(137/20) + 6/E^(17/20))  *)

% // N

(*  0.0137666  *)

• I just tried with NExpectation and I get the same problem. Now I try with the second method you proposed. Thanks – Francesco Coghi Feb 22 '17 at 15:10
• @FrancescoCoghi - what version and OS are you using? – Bob Hanlon Feb 22 '17 at 15:15
• I'm on windows10 with Mathematica 10.4 – Francesco Coghi Feb 22 '17 at 15:20