Question: Homework 13-Recursion Function Name: recursiveGetPi Inputs 1. (double) Number of terms to use in approximation Outputs: 1. (double) Result of the approximation Background You are

Homework 13-Recursion Function Name: recursiveGetPi Inputs 1. (double) Number of terms to use in approximation Outputs: 1. (double) Result of the approximation Background You are a mathlete taking the | in 1988. You have arrived at problem 6, which asks you to prove that for a, b N such that ab1 divides a2 , the number (a +/ab1) is a perfect square. After some thinking, you come up with an inventive way to use Vieta's formulas to solve the problem, which you decide to call Vieta Jumping. While writing down your proof, you decide to think about some of Vieta's other contributions to mathematics, including one of the first ways of calculating . Function Description There are many ways to calculate the mathematical constant . One of the ways to do it is based on a product of nested radicals. This fact will allow you to calculate 2 2 Each term is the square root of the quantity 2 plus the previous term all divided by 2. The first term is always . Write a function that takes in the number of terms to multiply together and approximates using the product of the terms. The function must be recursive Example >recursiveGetPi(3) 3.1214 = 0.6407 3.1214 2 Notes: . . e The input will always be a positive integer Do not round You must use recursion to solve this problem Hints: . A recursive helper function may be useful to calculate each nested radical . Look back at your original getPumpkinPi function from Week 3. Try using the same input in both functions and see which one is closer to m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
