Reference no: EM132394120
Assignment
1 Question
Given two lines defined by the equations:
y = m1x + b1
y = m2x + b2
Given the values: m1 = 0.9, b1 = -0.1, m2 = -1.2 and b2 = 1.5. Write a Python script which computes the point where these two lines intersect.
2 Question
Given the box shown in Figure 1. It has a width and height of 1. There is a boundary that bisects the box as shown. Region 1 is on the far side of the box. Write a Python script to throw 10,000 darts at the box. Print out how many land in region 1. Before you run your script use random.seed( 324 ).
![128_Figure 1.jpg](https://secure.expertsmind.com/CMSImages/128_Figure 1.jpg)
Figure 1: Figure for problem 2.
3 Question
Given the box shown in Figure 2. It has a width and height of 1. Two bisectors are shown. Region 1 is marked. Throw 10,000 darts at this box. Count how many darts land in region 1. Before you run your script use random.seed( 247 ).
![705_Figure 2.jpg](https://secure.expertsmind.com/CMSImages/705_Figure 2.jpg)
Figure 2: Figure for problem 3.
4 Question
Given the system shown in Figure 3. Each circle has a radius of 1. Write a script that throws 10,000 darts at the box. Count how many land inside of a circle. Before you run your script use random.seed( 231 ).
![299_Figure 3.jpg](https://secure.expertsmind.com/CMSImages/299_Figure 3.jpg)
5 Question
Figure 4 shows an ellipse inside of an encompassing box. An ellipse was to foci, and the distance d1 + d2 is a constant for all points on the perimeter of the ellipse. The equation for an ellipse is that is centered on the origin is:
x2/a2+y2/b2= 1,
where the length of the major (long ) axis is 2a and the length of the minor axis is 2b. The location of the foci along the x-axis are
±√(a2 - b2).
![710_Figure 4.jpg](https://secure.expertsmind.com/CMSImages/710_Figure 4.jpg)
Given a = 1 and b = 0.5. Write a Python script that counts the number of darts that land inside of the ellipse. Use random.seed( 23 ).
6 Question
Given 1000 random numbers, which can be denoted by xi where i = (0, ..., 999). Given the equation:
z =Σi(xi - x‾)2
where x‾ is the average of the x values. Write a Python script that computes z. Use random.seed(234).
7 Question
The equation for a standard deviation is:
σ =√(Σi(xi - x‾)2)/N - 1.
The numerator is the same equation used in the previous problem. Using the same random numbers from the previous problem, write a Python script to compute μ.
8 Question
Use the star program from the lecture. Write a Python script which counts the number of darts which land in each of these regions: 2, 4, 6, 9, 10. Note, do not sum these. Provide a count for each region. Throw 1000 darts. Use the random seed 95235.
9 Question
Create a box that has a length and width of 3. Divide this box up into 9 equally spaced regions. Throw 10,000 darts at this box. To show that the darts are randomly distributed, count the number of darts that land in each of 9 regions.
10 Question
What is the scientific name for this random dart method?