Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Probability Programming HW 2025

Info

  • Instructor : Professor Rung-Hung Gau
  • Student Name : Jing-Xuan Chen
  • Student ID : 113511170
  • Department : NYCU EE

Abstract

The square is randomly thrown on the x-y plane with its center fixed on the y axis.

And Y and θ are independent.

Objectives

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.

Python Code

  • 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.

Guide

  1. Enter the main code NYCU-113511170.py

  1. If enter 1, figure 1 is shown.

And the Simulated Result is printed:

  1. If enter 2, figure 2 is shown.

  1. If enter 3, figure 3 is shown.

  1. If enter 4, all the figure will be saved and named 113511170_figure0X.png.

  2. If enter 5, exit the program.

Homework Descriptions

About

Simulation for problems in probability, linear algebra, discrete math etc.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages