Menu

[Solved]Function Name Recyclepi Inputs 1 Double Number Fractions Use Approximation Outputs 1 Doubl Q37116950

MATLAB – using recursion Function Name: recyclePi Inputs: 1. (double) The number of fractions to use in your approximation Outputs: 1. (double) Your a

Function Name: recyclePi Inputs: 1. (double) The number of fractions to use in your approximation Outputs: 1. (double) Your approximation of pi rounded to 10 decimal places Background There are many ways to calculate r, and one of them is by using the continued fraction representation for (4 / π) + 1, as shown below. You might notice that it has a very regular pattern. Each base number of the numerator increases by 2, starting from 1, with every nested fraction. 2 4 2 9 2. Function Description: Using the continued fraction of (4 I jr) + 1 given above, write a function that approximates π using the number of fractions given as the input. The number of fractions is determined by the number of fraction bars that appears when the continued fraction is written Example >> approximationrecyclePi(3) >> approximation- 2.8952380952 +1 2 + 3 2+ Notes » The continued fraction yields the approximation for (4 / r) + 1, but your final solution should be an approximation of pi itself. Don’t be surprised if the approximations aren’t that close Round your final approximation to 10 decimal places, and use isequal() to make sure it matches the solution output! » . Show transcribed image text Function Name: recyclePi Inputs: 1. (double) The number of fractions to use in your approximation Outputs: 1. (double) Your approximation of pi rounded to 10 decimal places Background There are many ways to calculate r, and one of them is by using the continued fraction representation for (4 / π) + 1, as shown below. You might notice that it has a very regular pattern. Each base number of the numerator increases by 2, starting from 1, with every nested fraction. 2 4 2 9 2. Function Description: Using the continued fraction of (4 I jr) + 1 given above, write a function that approximates π using the number of fractions given as the input. The number of fractions is determined by the number of fraction bars that appears when the continued fraction is written Example >> approximationrecyclePi(3) >> approximation- 2.8952380952 +1 2 + 3 2+ Notes » The continued fraction yields the approximation for (4 / r) + 1, but your final solution should be an approximation of pi itself. Don’t be surprised if the approximations aren’t that close Round your final approximation to 10 decimal places, and use isequal() to make sure it matches the solution output! » .

Expert Answer


Answer to Function Name: recyclePi Inputs: 1. (double) The number of fractions to use in your approximation Outputs: 1. (double) Y… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *