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

  Create a program that computes fuel economy

How would you create a program that computes fuel economy of a multi leg journey where the program first prompts for starting odometer reading.

  What is the check digit needed to complete the isbn

we can use the notion of parity to detect when an error occurs during transmission of data. International Standard Book Number.

  Write a program that will calculate the problem and stop

Write a program that will calculate the problem and stop after the condition has been met. a=number of loops start with zero.

  Create a list called readinglist with two books

Define a function called printList that takes in a list as a parameter and prints the entries in the list one entry per line. If the list is empty have program.

  Write a program that prompts the user to enter an integer

Write a program that prompts the user to enter an integer for today's day of the week Also prompt the user to enter the number.

  Simulate the monty hall problem

In this problem, we will be writing pieces to simulate the Monty hall problem. Monty Hall was the host of "Let's Make a Deal" in the 1960's and 70's.

  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.

  Compute the orders for a takeaway coffee shop

Create a Python program that will compute the orders for a Takeaway Coffee shop.

  Write an expression that concatenates the string

Write an expression that concatenates the String variable suffix onto the end of the String variable prefix .

  Simulate the real-time data from two sensors

The task is to get real-time data from two sensors connected to Raspberry Pi 3 GPIO. What you can do is simulate random values from 0-10 for both sensors

  Display an error message and set the number of that item

This program is about exception handling. A hotdog stand sells hotdogs, potato chips and sodas. Hotdogs are $2.50 each. Potato chips are $1.50 per bag.

  Design and implement an english test

CSP1150 - Programming Principles - You are required to design and implement an "English Test" program in which the user is presented with a word and then asked to answer a simple question about the word. After 5 words, the program shows the user's..

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