Expected value of random variables

asked 2019-01-10 14:33:00 -0600

anonymous user


I'm new to SAGE and just getting my feet wet. Would greatly appreciate if someone could point me to how to calculate the following using SAGE:

Say I have an event drawn from a Poisson distribution that happens on average once a year. I'd like to define a random variable and then calculate the following:

  1. Probability the event will occur after 1 month (1/12th of a year)

  2. Probability the event will not occur for 2 years but will occur during the third year.

I've searched unsuccessfully for how to do this and would greatly appreciate any help.

edit retag flag offensive close merge delete


Is it homework ? Before trying to solve such a problem with Sage, how would you have solved it by hand ?

tmonteil gravatar imagetmonteil ( 2019-01-10 18:03:21 -0600 )edit

It’s not homework. I created the toy problem myself and can easily solve it by hand using the poisson equation (and it’s clear to me how to write code to do that in SAGE). I was just under the impression that there’s some library that will do all this for you in SAGE but maybe I’m wrong? Just want to reiterate this is a toy problem that I made to illustrate my question, which was mostly about SAGE’s built in support for reasoning with random variables.

kyesledge gravatar imagekyesledge ( 2019-01-10 19:12:55 -0600 )edit

Please then provide code that declares the distribution. Or just describe the model, the distribution exactly (in mathematical terms). There is a way from "Say I have an event drawn from a Poisson distribution that happens on average once a year" to a declared distribution of a random variable.

dan_fulea gravatar imagedan_fulea ( 2019-01-25 12:39:10 -0600 )edit