Smallest value for n in Leibniz Formula for Pi
이전 댓글 표시
Hello, I am new to MATLAB and am having some trouble to solve this problem. Given the Leibniz Formula for Pi:

In which A is the result for a given N, and R becomes Pi as N increases:

Here it is defined the relative error E=|(A-R)/R)|. What I need to look for is the smallest value for N in the case of E<=10^-6. This is what I`ve been trying in matlab so far:

What I get is a list for all the values for A and R, as well as ans=[]. but I don`t know how to ask exactly for the value of N for my desired E. I`m sorry if this is a stupid question, like I said I just started using matlab. Any help would be appreciated.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!