# Monte Carlo integration

#### chimath35

1. The problem statement, all variables and given/known data
Perform a Monte Carlo integration of:

∫ xdx/(2+3x)^2 with the bounds of 0 and 1 on the integral

You should use 10 trials of at least 100 data pairs per trial and average the result

I guess I am supposed to generate a x and y random number between 0 and 100 and if the output of
y=x/(2+3x)^2 is equal to the y ran I count it

I really only know and have been shown how to use libre calc not sure how to do this

2. Relevant equations

3. The attempt at a solution

Related Calculus and Beyond Homework News on Phys.org

#### mfb

Mentor
I guess I am supposed to generate a x and y random number between 0 and 100
What is between 0 and 100?
and if the output of
y=x/(2+3x)^2 is equal to the y ran I count it
It won't be equal exactly, there is a different condition (hint: you are approximating an integral).

Every spreadsheet can do that, programming languages would be better for larger samples but for just 100 data pairs it does not matter.

#### chimath35

okay so I pick an x value between 0 and 1 (random) and what do I pick the y value between?

#### chimath35

I have the actual value of the integral and I know it is a ratio of y≤x/(2+3x)^2 count as success/ of total # of trials for each x value

#### chimath35

Never mind, I understand the process now and have solved the problem. Thank you for the input.

"Monte Carlo integration"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving