*6.14 (Estimate $\pi$) $\pi$ can be computed using the following series: $m(i) = 4\left(1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \frac{1}{9} - \frac{1}{11} + \dots + \frac{(-1)^{i+1}}{2i - 1}\right)$ Write a function that returns $m(i)$ for a given $i$ and write a test program that displays the following table: $\begin{array}{|c|c|} \hline i & m(i) \\ \hline 1 & 4.0000 \\ 101 & 3.1515 \\ 201 & 3.1466 \\ 301 & 3.1449 \\ 401 & 3.1441 \\ 501 & 3.1436 \\ 601 & 3.1433 \\ 701 & 3.1430 \\ 801 & 3.1428 \\ 901 & 3.1427 \\ \hline \end{array}$
Added by Tasha T.
Close
Step 1
First, we need to define the function m(i) that returns a value for a given i. The formula for m(i) is Show more…
Show all steps
Your feedback will help us improve your experience
Ali Karimiafshar and 98 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
def gic(value, years, rate): """ Calculates and prints a table of how much a GIC (Guaranteed Income Certificate) is worth over a number of years, and returns its final value. Use: final_value = gic(value, years, rate) ------------------------------------------------------- Parameters: value - GICs initial value (int > 0) years - number of years to maturity (int > 0) rate - percent increase value per year (float > 0) Returns: final_value - the final value of the GIC (float) """
Supreeta N.
A table of values for a linear function is given. Fill in the missing value and calculate $m$ in each case. $$ \begin{array}{|c|c|c|c|} \hline x & -1 & 0 & 1 \\ \hline y & -1 & -3 & \\ \hline \end{array} $$
Functions and Linear Models
Linear Functions and Models
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD