Write a python script which counts the number of darts

Assignment Help Python Programming
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

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

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

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

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?

Reference no: EM132394120

Questions Cloud

What financial challenges healthcare leaders would face : What are some of the financial challenges healthcare leaders and managers would face considering today's factors? Consider real-life internal and external.
IT Security govern information technology : Although it is not classified as being such, does not IT Security govern information technology within an organization?
Find the weighted mean for the three exams : Find the weighted mean for the three exams if the first one was worth 25% and the student received a 92, the second was worth 40% and the student received
Analysis of the influence of adultism in the logan case : Adultism refers to the oppression of young people by adults. The popular saying "children should be seen and not heard" is used as a way to remind a child.
Write a python script which counts the number of darts : 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.
Describe the cultural event in which you participated : Describe the cultural event in which you participated. Explain how this experience influenced your perceptions of diversity and difference.
Implementing new interorganizational system : You are a member of the Human Resource Department of a medium-sized organization that is implementing a new interorganizational system
Which ethical and other factors are relevant to decisions : Ethical questions and issues arise at both the level of setting laws and policies and the level of deciding what to do where, those are indeterminate.
Mitigation plan for health network : Mitigation Plan For A Health Network Inc. Handles secure electronic medical messages between. Current risk assessment outdated

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd