Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Post in C language. pi = sqrt(12) * (1 (1/(3 3^1)) + (1/(5 3^2)) - (1/(7 3^3)) + (1/9 3^4)) ) 16.28 Lab 4, P3(T):

image text in transcribed

Post in C language. pi = sqrt(12) * (1 (1/(3 3^1)) + (1/(5 3^2)) - (1/(7 3^3)) + (1/9 3^4)) )

16.28 Lab 4, P3(T): Pi approximation This lab will be available until February 11th, 2:00 PM MST The value of n can be approximated using the Madhava formula pi = sqrt (1 -(1/(3-3-1)) + (1/(5 - 3^2)) - (1/(7.343)) + (1/9. 3^4))...) Write a C program that calculates the value of pi with a variable level of accuracy. For instance, if the desired accuracy is 10^-6, the absolute difference between the true value of n (see below) and the approximation from your function is less than 10^-6 Develop a function called pivalue that receive as input the numerical accuracy (in number of digits) and returns the calculated pi value. double pivalue (int numAccuracy); Sample Output: To what precision do you wish to calculate Pi? 4 pi = 3.14167431, within accuracy of 1E-4. Error = 0.00008166 301608.1764500 LAB ACTIVITY 16.28.1: Lab 4, P3(T): Pi approximation 0/4 main.c Load default template... 1 #include 2 #include 3 #define PI 3.141592653589793238462643383 5 double piValue(int numAccuracy); int main(void) { HBBBBB 9 //develop your code here and call the piValue 10 11 12 return(0); 13 } 15 double piValue(int numAccuracy) { 16 //approximate the value of piusing the Madhava formula 17 18 } Develop mode Submit mode Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the vendbou 16.28 Lab 4, P3(T): Pi approximation This lab will be available until February 11th, 2:00 PM MST The value of n can be approximated using the Madhava formula pi = sqrt (1 -(1/(3-3-1)) + (1/(5 - 3^2)) - (1/(7.343)) + (1/9. 3^4))...) Write a C program that calculates the value of pi with a variable level of accuracy. For instance, if the desired accuracy is 10^-6, the absolute difference between the true value of n (see below) and the approximation from your function is less than 10^-6 Develop a function called pivalue that receive as input the numerical accuracy (in number of digits) and returns the calculated pi value. double pivalue (int numAccuracy); Sample Output: To what precision do you wish to calculate Pi? 4 pi = 3.14167431, within accuracy of 1E-4. Error = 0.00008166 301608.1764500 LAB ACTIVITY 16.28.1: Lab 4, P3(T): Pi approximation 0/4 main.c Load default template... 1 #include 2 #include 3 #define PI 3.141592653589793238462643383 5 double piValue(int numAccuracy); int main(void) { HBBBBB 9 //develop your code here and call the piValue 10 11 12 return(0); 13 } 15 double piValue(int numAccuracy) { 16 //approximate the value of piusing the Madhava formula 17 18 } Develop mode Submit mode Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the vendbou

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago