Program that accepts the number of darts as an input

Assignment Help Basic Computer Science
Reference no: EM131305075

Monte Carlo techniques can be used to estimate the value of pi. Suppose you have a round dart board that just fits inside of a square cabinet. If you throw darts randomly, the proportion that hit the dart board vs. those that hit the cabinet (in the corners not covered by the board) will be determined by the relative area of the dart board and the cabinet. If n is the total number of darts randomly thrown (that land within the confines of the cabinet), and h is the number that hit the board, it is easy to show that

2427_cfd90810-4b46-4411-8fd7-3a36ea2699f4.png

Write a program that accepts the "number of darts" as an input and then performs a simulation to estimate π. Hint: you can use 2*random() - 1 to generate the x and y coordinates of a random point inside a 2x2 square centered at (0, 0). The point lies inside the inscribed circle if x2 + y2 ≤ 1.

Reference no: EM131305075

Questions Cloud

Analyze the legal rights and responsibilities of the tenant : Explore the legal rights and responsibilities of the tenant and the landlord. Decide whether or not the landlord and / or the tenant had a legal duty to mitigate damages.
Performs a simulation to estimate the probability of rolling : Suppose you take a random walk of n steps. On average, how many steps away from the starting point will you end up? Write a program to help you investigate this question.
Credit risk file based on different types of loans : Describe how to apply stratified sampling to sample from the Credit Risk file based on the different types of loans. Implement your process in Excel to choose a random sample consisting of 10% of the records for each type of loan.
What is a banks net interest margin : What is a T-account? Use a T-account to show the effect on Bank of America's balance sheet of your depositing $50 in currency in your checking account.
Program that accepts the number of darts as an input : Write a program that accepts the "number of darts" as an input and then performs a simulation to estimate π. Hint: you can use 2*random() - 1 to generate the x and y coordinates of a random point inside a 2x2 square centered at (0, 0). The point l..
Dividend policy can also be considered irrelevant : Modigliani & Miller show that dividend policy can also be considered irrelevant. Yet, unexpected increases in dividends are often closely followed by price increases, why? To clarify, when a firm pays a dividend the stock price should drop by the amo..
Why might banks shareholders want bank to be less leveraged : Why might the managers of a bank want the bank to be highly leveraged? Why might the bank's shareholders want the bank to be less highly leveraged?
How you would motivate the student to perform in class : Identify which of Maslow's need(s) each student is trying to fulfill. Explain how you would motivate the student to perform in class.
How the balance sheets of each bank will be affected : Suppose that Lena, who has an account at SunTrust Bank writes a check for $100 to José, who has an account at National City Bank.- Use T-accounts to show how the balance sheets of each bank will be affected after the check clears.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Representing negative numbers

what the rule is for determining which bit is the sign bit. Try and test your theory to be sure. See if you can prove and/or disprove it. Write down your theory of how the sign bit is indicated

  Security policy framework

You will create an organizational security plan policy using your assigned readings (pay close attention to Chapter 3 in the Building an Effective Information Security Policy) as well as the Cybersecurity Framework  as a resource, creating a two ..

  List three traditional crimes

List three "traditional crimes" and explain how technology is used to facilitate them.

  An addressing and naming model in an environment

Outline a plan for the development of an addressing and naming model in an environment of the following scenario:

  Evaluate the consequences of a poor hiring decision.

Evaluate the consequences of a poor hiring decision. Propose steps that could be taken to prevent such bad decisions in the first place.

  Evaluate the following postfix expressions

Evaluate the following postfix expressions by using the algorithm given. Show the status of the stack after each step of the algorithm. Assume that division is integer division as in java and the identifiers have the following values: a=7;b=3;c=12..

  Find the fraction of steam extracted for process heating

Consider a cogeneration power plant that is modified with reheat and that produces 3 MW of power and supplies 7 MW of process heat

  Compute the adjusted treatment means

Compute the adjusted treatment means and their standard errors using the data in Problem 15.15.

  What are benefits of bipolar transfer functions of neurons

What are the benefits of the bipolar transfer functions of neurons? Are they present in the brains of humans and animals? Why?

  Distinct integers that has the following property

You have an array A[0], A[1], ..., A[n - 1] of distinct integers that has the following property:The values in the array increase up to index p for some p between 0 and n - 1, and then decrease for all indices beyond p through positio

  Discuss the necessity for using counterbalancing

Discuss the necessity for using counterbalancing. Create a table illustrating the experimental design.

  Explain the security vulnerabilities associated

Briefly describe your mobile device and another device currently on the market that uses a different OS. Explain the security vulnerabilities associated with each device. Explain the security solutions that would address the vulnerabilities. Final..

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