Question

# Practice Question: 'Write a function Pi(n) to compute an approximate value of pi based on the first n

terms.'

Basically, I am being asked to compute the **Leibniz formula for π** using R code, which I am having trouble with.

Can you give me the solution in R code as to how to accomplish this? I have an exam tomorrow and I want to try to understand how to create a function for an infinite series of numbers.

The following link is what the mathematical equation looks like:

https://wikimedia.org/api/rest_v1/media/math/render/svg/fab3e3e4febf987b57159d81fd47995fb0af1240

### Recently Asked Questions

- 1.Attacks that are so new to the Internet that they haven't yet been classified and for which no patches have been written are called "zero-day attacks". Do

- Create the following matrix, which stores the name and suit of every card in a royal flush. ## [,1] [,2] ## [1,] "ace" "spades" ## [2,] "king" "spades" ## [3,]

- A function in LANGUAGE C that two positive integers j and f , and works as follows 1. prints all increasing sequences of length f consisting of the numbers