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 a program in q basic that accept student name

Write a program in Q basic that accept a student name,score obtained in 5 course and compute the average score of the student and my program must display the name of the student

  Explain inheritance structures of galaga

Write a 3-page paper about inheritance structures of Galaga. Recognize the parent and child classes and describe what each class has for events and data.

  Technical project: sample website project

Technical Project: Sample Website Project , This assignment consists of three (3) sections: a narrative, a storyboard, and a business Website. You must submit all three (3) sections for the completion of this assignment.

  Write pseudocode that takes number entered by user

Write a piece of pseudocode that takes a number entered by the user and prints out every number from that number up to 100 and then prints END.

  Write a perl program

Write perl program which will run on my system and will start another perl program on another linux system. The main program should wait for linux perl program to complete its work and send the result to my main perl program.

  Write a method that returns the value of base exponent

Write a method IntegerPower(base, exponent) that returns the value of base exponent For example, IntegerPower(3, 4) = 3 * 3 * 3 * 3.

  Write program to instantiate objects of inherited classes

X-Y coordinate pairs for four endpoints of Quadrilateral. Write program which instantiates objects of the classes and outputs each object's area.

  Write functions to implement split-mergesort for files

Write functions to implement the split, merge, and mergesort algorithms for files. Also, write driver programs to test the given functions.

  Comparing running time of two algorithm

Which algorithm would you prefer on the basis of running time, suppose all other factors equal?

  Creating code for method tostring

Fill in the code for method toString, which must return a string containing the name, account number, and balance for the account.

  Write class called flight which represents airline flight

Draw and implement the class called Flight which represents an airline flight. It must contain instance data which represents airline name (String), flight number (int), and the flight's origin city (String).

  Give value of mytop and contents of the array

Assume that stack is the class described in this section with stacktype set to int and stack_capacity or mycapacity set to 5. Give the value of mytop and the contents of the array.

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