- Instructor : Professor Rung-Hung Gau
- Student Name : Jing-Xuan Chen
- Student ID : 113511170
- Department : NYCU EE
The square is randomly thrown on the x-y plane with its center fixed on the y axis.
And Y and θ are independent.
The goal is to get the E[qn] and E[W] via conducting the simulation for the large enough number of times.
-
In Task 1, Y and θ are uniformly distributed. Figure 1 is created to show qn, the sum of Bernoulli random variable ak, for k=1, 2…n.
-
Task 2 holds a difference from Task 1. θ is still uniformly distributed, yet Y is not.
-
Task 3 requires finding the expected value of W, which is the area of square that below x axis.
-
Merge all the program in main code NYCU-113511170.py.
-
NYCU-113511170.py : main program
-
figure01.py : Task 1
-
figure02.py : Task 2
-
figure03.py : Task 3
-
verify_area.py :
To verify if E[W] obtained from figure3.py is correct.
The file is not for simulation but for direct computing the double integration.
- Enter the main code NYCU-113511170.py
- If enter 1, figure 1 is shown.
And the Simulated Result is printed:
- If enter 2, figure 2 is shown.
- If enter 3, figure 3 is shown.
-
If enter 4, all the figure will be saved and named 113511170_figure0X.png.
-
If enter 5, exit the program.






