Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

Hi;

This problem appears in the Devore book "Probability and Statistics" and has various answers on the internet.

The weekly demand for propane gas (in thousands of gallons) from a particular facility is a random variable X with PDF

What is the expected usage for gas for the coming week?

A number of different answers are given. How can we get the answer using a CAS and simulating the process?

1) Define the PDF in mathematica as:

`myPDF[]=ProbabilityDistribution[2(1-1/x^2),{x,1,2}];`

2) Run the simulation a million times.

`data=RandomVariate[myPDF[],10^6];`

Below is a histogram of data.

3) Get the expected value:

`Mean[data]`

1.61357 is returned. So the facility expects to use about 1613 gallons of propane this week.

*Last edited by bobbym (2013-03-07 15:35:57)*

**In mathematics, you don't understand things. You just get used to them.I have the result, but I do not yet know how to get it.All physicists, and a good many quite respectable mathematicians are contemptuous about proof.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

And it agrees with my answer of 3-2ln(2).

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

More importantly were you able to duplicate the answer with your package?

**In mathematics, you don't understand things. You just get used to them.I have the result, but I do not yet know how to get it.All physicists, and a good many quite respectable mathematicians are contemptuous about proof.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

I will try later.

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

Okay, you will find it interesting.

**In mathematics, you don't understand things. You just get used to them.I have the result, but I do not yet know how to get it.All physicists, and a good many quite respectable mathematicians are contemptuous about proof.**

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

What kind of distribution would that be?

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

The one given in post #1 of course!

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

Yes, but what kind is it? Maxima needs me to specify if it is a normal, geometrical, exponential,...

Here lies the reader who will never open this book. He is forever dead.

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

It is none of them.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

I am not sure how to do it, then.

Here lies the reader who will never open this book. He is forever dead.

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

Would you like one way how?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

Yes.

Here lies the reader who will never open this book. He is forever dead.

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

Hi;

I am playing with a method right now but do not have all the kinks ironed out of it. I will post what I have.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

That is okay.

Here lies the reader who will never open this book. He is forever dead.

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

I want to draw random numbers from the PDF y = 3x^2 from 0 to 1.

So I solve for x

Follow?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

Yes.

Here lies the reader who will never open this book. He is forever dead.

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

Then I take the RHS of that equation where I solved for x and integrate wrt y.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

Okay. What now?

Here lies the reader who will never open this book. He is forever dead.

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

I replace each y in the answer with a random variable that is uniformly distributed between 0 and 1.

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

Hm, why does it work?

Here lies the reader who will never open this book. He is forever dead.

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

It doesn't, I think I have it now though. To follow you must know how to generate random numbers between a and b in maxima. Do you follow?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

Yes. I have the function.

Here lies the reader who will never open this book. He is forever dead.

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

Okay a little theory before we go any further. If you generate 10000 random numbers between 0 and 1 what do you call that distribution?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,236

Uniform.

Here lies the reader who will never open this book. He is forever dead.

**Online**

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 84,285

You will need to know how to get a histogram of those 10000 points with 10 boxes. Do you know how?

I have the result, but I do not yet know how to get it.

All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

**Online**