Question: PI (1). Simple and Double Factorial. The main evaluation topic is the implementation of fixes (arrays) in a solution. The double factorial should not be

 PI (1). Simple and Double Factorial. The main evaluation topic isthe implementation of fixes (arrays) in a solution. The double factorial should

PI (1). Simple and Double Factorial. The main evaluation topic is the implementation of fixes (arrays) in a solution. The double factorial should not be confused with the calculated simple factorial twice. The simple factorial calculated twice could be expressed as (n!)!, While the double factorial is n !!. In mathematics the double factorial or semi factorial of a number n, denoted like n!! is calculated as follows: If n is odd, n!! is the product of the integers from 1 to n (1*3*... n) jumping two by two. Without it's even, n !! is the product from 2 to n, (2*4*6*... n) jumping two by two. The product happens between numbers with the same parity (all even or all odd)]. Using mathematical notation: If n is even, the double factorial is: n!! = k=1 2k Alternatively: n!! = n(n-2)(n-4)...4.2 If n is odd, the double factorial is: n!! =]](2k 1) k=1 Alternatively: n!! = n(n-2)(n- 4)...3:1 Recursively (ignore for now): n!! = n (n - 2)! for n# 2 and n1, & 2!! = 2 and 1!! = 1 are definitions Example: 6!! = 6 + 4 + 2 = 48 n is even, factors are even 7!! = 7 * 5 * 3 * 1 = 105 n is odd, factors are odd 2!! = 2 and 1!! = 1 are definitions Now that you know how to calculate the double factorial, write a program in pyhton-3 to calculate the value of it with the following formula: TT 2 - & k! (2k + 1)!! Eq.1 k=0 The value of pi must be calculated until the error percentage is less than 1x102 (equivalent to 1e-2 in Python). To achieve this it is necessary that the above equation, whose series runs to infinity, be approximate for a finite number n of terms: -3 k! (2k + 1)!! Eq.2 k=0 The computation of k! in the numerator y of (2k + 1)!! in the denominator you must do it with basic programming (the math.factorial library function in the math module is prohibited). Although it is convenient to say that it is also beneficial to calculate k! with the function of the bookstore to round out your learning and for your own benefit. The computation of the percentage of error that is committed using Eq. 2 above can be obtained by the formula: error percent It series - Tinumpy 100 Eq.3 Trumpy Use the numpy:pi parameter (in the numpy module) as the true value of pi. The result main program (output) is the number of terms needed in Eq.2 (that is, n + 1) to meet the error condition and the approximate value of pi expected. To calculate the absolute value from Eq.3 uses a function from the Python library

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!