Use a while loop to calculate terms of summation

Assignment Help Programming Languages
Reference no: EM1372343

The brilliant mathematician Srinivasa Ramanujan found an infinite series that can be used to generate a numerical approximation of π:

2 √ 2 ∞ (4k)!(1103+26390k)1= ∑π (k!)4 3964k9801 k=0

Write a function called estimate_pi that uses this formula to compute and return an estimate of π. It should use a while loop to compute terms of the summation until the last term is smaller than 1e-15 (which is Python notation for 10-15). You can check the result by comparing it to math.pi.

Reference no: EM1372343

Questions Cloud

Compute percentage change of real exchange rate : Compute percentage change of real exchange rate between US and Japan in past year. Has US Dollar become weaker or stronger in real term.
How much thicker is the center than edges : Assume this is the innermost line of interference (m = 0) and that speed of sound in air is 331 m/s, find the (linear) frequency of the sound in Hz.
Compute total profits at the optimum level of output : The Zinger Corporation manufactures and sells a line of sewing machines. Demand per period for a particular model is given by the following relationship:
What should be quantity sold in each market : If they charge same price in each market, what should be quantity sold in each market, equilibrium price and total profit.
Use a while loop to calculate terms of summation : Write function called estimate_pi that uses this formula to calculate and return estimate of π. It must use a while loop to calculate terms of summation until last term is smaller than 1e-15.
Compute the output level to maximize profit : Woodland Instruments, Company operates in highly competitive electronics industry. Prices for its R2-D2 control switches are stable at $100 each.
What long run adjustments should you anticipate : what price and quantity of computers should you produce to maximize your firm's profits. What long run adjustments should you anticipate.
How much heat does the system liberate : while a system is taken from state a to state b in the figure below the path acb, 84.0 of heat flows into the system and 57.0 of work is done by the system.
Write a strategic form also find optimal strategy of player : There are two players 1 and 2. re are two cards: "High" and "Low". Player 1 chooses at random one card. Write a strategic form also find optimal strategy of player.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write program to accept name and score of all batsmen

Write a program to accept name and score of all batsmen of a team and print them in the given manner: INPUT:names[]={nam1,nam2,nam3,nam4,nam5,nam6} & scores[]={48,65,73,10,90,84}

  Design program to enter a series of numbers

Design a program that asks the user to enter a series of 20 numbers. The program should determine whether the number is valid by comparing it to the following list of valid charge account numbers.

  Use switch statement to display roman numeral version

Use a switch statement to display the Roman numeral version of that number. Input Validation: Do not accept a number less than 1 or greater than 10.

  Develop project to calculate checking account balance

Develop project to calculate your checking account balance. Form: Include radio buttons to indicate the type of transaction: deposit, check, or service charge.

  Write program to allow user to enter marks of students

Write a program that allows user to key in marks of students. The number of students is determined by the user at the start of the program.

  Include hyperlink for confirming order in online ticket

Include a check box for attending the Awards Event. Include a hyperlink for confirming the order. Make the link invisible to begin but display it after the Submit button has been clicked.

  Create and write payroll program to prompt user for input

Create and write a payroll program that will prompt the user to enter employee's hourly pay rate and the number of hours worked.

  Create a simple shell

Create a simple shell. Basically your shell should read the line from standard input, parse the line with command and arguments, and operate the command with arguments.

  Complete a request for system services

Objectives Complete a Request for System Services form, which triggers the preliminary investigation phase. Analyze a user interview and extract pertinent facts, which can be used to assess project feasibility. Complete a Problem Stateme..

  Write program to accept data for each student

Write a program that accepts data for each student in the school - Student ID, classroom number, and score on the achievement test. Design a program that lists the total points scored for each of the 30 classrooms.

  Write program which simulates checkout queue object

Write program which simulates checkout line at supermarket. Line is queue object. Customers (i.e., customer objects) arrive in random integer intervals of 1-4 minutes.

  Binary search algorithm to search an array

The binary search algorithm that follows may be used to search array when elements are in order. This algorithm is analogous to following approach for finding name in telephone book.

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