Is this method of estimating Pi too similar to Archimedes' method?

  • Context: High School 
  • Thread starter Thread starter Eclair_de_XII
  • Start date Start date
  • Tags Tags
    Archimedes Method Pi
Click For Summary

Discussion Overview

The discussion revolves around methods of estimating the value of Pi, specifically comparing a proposed recurrence relation to Archimedes' method. Participants explore the mathematical foundations, implications of using trigonometric functions, and the potential circular reasoning involved in the calculations.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested, Mathematical reasoning

Main Points Raised

  • One participant presents a recurrence relation for estimating Pi and questions its originality, suggesting it resembles Archimedes' method.
  • Another participant argues that using trigonometric functions like tan and atan to estimate Pi may lead to circular reasoning.
  • Some participants discuss the possibility of expressing trigonometric terms in purely algebraic forms to avoid circularity.
  • There are suggestions for alternative recursive sequences to estimate Pi, including modifications to existing formulas.
  • Participants share code implementations to validate their approaches and discuss issues related to rounding errors in calculations.
  • One participant proposes a new recursion formula for calculating tangent values that may improve convergence.

Areas of Agreement / Disagreement

Participants express differing views on the validity of using trigonometric functions in the estimation process, with some suggesting it leads to circular reasoning while others believe it can be managed. There is no consensus on the best method or the originality of the proposed approaches.

Contextual Notes

Some participants note limitations related to the dependence on trigonometric functions and the potential for rounding errors in numerical calculations. The discussion also highlights the complexity of deriving estimates without circular dependencies.

Eclair_de_XII
Messages
1,082
Reaction score
91
TL;DR
It was derived by inscribing half a semi-circle within a square of side-length one, and estimating the arc length by using hypotenuses of triangles whose side lengths depend on the length of one of the previous hypotenuses recursively, then multiplying the hypotenuse by a certain power of two.
The recurrence relation was given as:

##p_k=2^{k+1}\cdot h_k##

where

##h_0^2=2##
##h_{k+1}^2=(\frac{1}{2}h_k)^2+(1-\frac{1}{2}h_k \cdot \cot(2^{-k}\cdot \alpha))^2##

and ##\alpha=\arctan(1)##.

This is not exactly an original or noteworthy derivation, is it? I feel that it's been done already two-thousand years ago, and I even found a web-page showing nearly exactly the same thing I am describing right now.

https://www.craig-wood.com/nick/articles/pi-archimedes/

Oh, and I did write some code that confirmed the validity of this recursion.

Python:
import math

def hypotenuse_sequence(n):
    """This function calculates the length of the hypotenuse of any given right triangle after the n-th recursion.

    Input: integer
    Output: positive number

    """
    if n==0:
        return math.sqrt(2)
    angle = math.atan(1)
    x = hypotenuse_sequence(n - 1) / 2
    y = 1 - x/math.tan(2 ** (-(n - 1)) * angle)
    return math.sqrt(x**2+y**2)

def est_pi_8th(n):
    """This function returns an actual estimate of pi using the hypotenuse_sequence function.

    Input: integer
    Output: estimate of pi

    """
    return hypotenuse_sequence(n)*2**(n+1)
 
Mathematics news on Phys.org
A sketch would help a lot here.

The calculation of tan and atan depends on knowing pi (or approximating it somehow). Using these functions to find pi is a circular approach. You could just calculate 2 atan(1010).
 
mfb said:
A sketch would help a lot here.

fbd.png

The base case is just ##h_0=\sqrt{2}## (or ##r_0## in this picture). You take half of that as one of the legs of the new triangle after the first recursion, and apply the Pythagorean Theorem after finding the length of the other side to get ##h_1##. The ##h_n## is the side of a hypotenuse generated after the ##n##-th recursion; ##p_n## is just the estimate of ##\pi##.
mfb said:
The calculation of tan and atan depends on knowing pi (or approximating it somehow). Using these functions to find pi is a circular approach.

So it is not possible even if a half-angle formula for tangent, say

##\tan(\theta)=\frac{1-\cos(2\theta)}{\sin(2\theta)}##

were used for known values of ##\sin(2\theta)## and ##\cos(2\theta)##? From there, isn't it possible to make use of the value of ##\tan(\theta)## in order to find ##\sin(\theta)## and ##\cos(\theta)## using the Pythagorean Theorem, which can be then used to find ##\tan(\theta / 2)## and so on?
 
Last edited:
If you can write the final expressions without using any trigonometric functions it will work, otherwise it will not.
 
mfb said:
If you can write the final expressions without using any trigonometric functions it will work, otherwise it will not.

Let's see, we start with ##\alpha=\arctan(1)##. We can just call this "the angle<##\pi/2## of a right triangle such that the opposite and adjacent sides are equal".

--

The base case:

##\tan(\alpha)=1##

--

It is implied here that the opposite side is equal to the adjacent side. Let's call them ##y,x## respectively; both are positive by convention. Hence, we have that:

##\sin(\alpha)=\frac{y}{\sqrt{y^2+x^2}}=\frac{y}{\sqrt{2y^2}}=\frac{y}{|y|\cdot \sqrt{2}}=\frac{1}{\sqrt{2}}##

Similarly:

##\cos(\alpha)=\frac{x}{\sqrt{y^2+x^2}}=\frac{x}{\sqrt{2x^2}}=\frac{x}{|x|\cdot \sqrt{2}}=\frac{1}{\sqrt{2}}##

From the formula earlier:

##\tan(\alpha/2)=\frac{1-\cos(\alpha)}{\sin(\alpha)}=\frac{1-\frac{1}{\sqrt{2}}}{\frac{1}{\sqrt{2}}}=\sqrt{2}-1##

--

From the value of the tangent function evaluated at ##\alpha/2##, it is implied that ##y=(\sqrt{2}-1)x##. Let's calculate the hypotenuse length:

##h=\sqrt{y^2+x^2}=\sqrt{((\sqrt{2}-1)x)^2+x^2}=\sqrt{x^2((\sqrt{2}-1)^2+1)}=|x|\cdot \sqrt{(2-2\sqrt{2}+1)+1}=x\cdot \sqrt{4-2\sqrt{2}}##

Calculate ##\sin(\alpha/2)## and ##\cos(\alpha/2)## as follows:

##\sin(\alpha/2)=\frac{y}{h}=\frac{(\sqrt{2}-1)x}{x\cdot \sqrt{4-2\sqrt{2}}}=\frac{\sqrt{2}-1}{\sqrt{4-2\sqrt{2}}}##
##\cos(\alpha/2)=\frac{x}{h}=\frac{x}{x\cdot \sqrt{4-2\sqrt{2}}}=\frac{1}{\sqrt{4-2\sqrt{2}}}##

Hence,

##\tan(\alpha/4)=\frac{1-\cos(\alpha/2)}{\sin(\alpha/2)}=\frac{\sqrt{4-2\sqrt{2}}-1}{\sqrt{2}-1}##

--

So I think I can do this any number of times. I sure do not want to, because it will get extremely messy. But I am sure that it is always possible to express the trigonometric term in any member of the recursive sequence as a purely algebraic term. It suffices to follow the algorithm outlined in this post.

Sorry for the multiple edits, by the way. I have a nasty habit I must kick.
 
Last edited:
Looks like it can work, although a direct recursion formula would be easier.
 
mfb said:
Looks like it can work, although a direct recursion formula would be easier.

Something like this, then?
--
Let ##p_n## be the estimate of ##\pi## after the ##n##-th recursion.

##p_0=2\sqrt{2}##
##p_{k+1}=2^{k+2}\cdot \sqrt{(2^{-(k+2)}\cdot p_k)^2+(1-2^{-(k+2)}\cdot p_k \cdot \cot(2^{-k}\cdot \alpha))^2}##

where ##\alpha=\arctan(1)##.
--
Oh yeah, and I wrote some code for this sequence.
Python:
def new_pi(n):
    """This function calculates an estimate of pi using direct recursion.
    It was derived using the est_pi_8th and hypotenuse_sequence functions,
    and the relation described by the former.

    Input: non-negative integer
    Output: estimate of pi

    """
    if n==0:
        return 2*math.sqrt(2)
    angle = math.atan(1)
    x=new_pi(n-1)/2**(n+1)
    y=1-x/math.tan(angle/2**(n-1))
    z=math.sqrt(x**2+y**2)
    return 2**(n+1)*z
 
Eclair_de_XII said:
...using hypotenuses of triangles
Nitpick: Hypoteneese.

:oldbiggrin:
 
Huh, I learn something new everyday.
 
Last edited:
  • #10
That was a joke. :wink: ..
 
  • #11
Eclair_de_XII said:
Something like this, then?
That has the trigonometric functions in again.
 
  • #12
Of course.
--
Define a recurse sequence ##t_{n+1}## calculating ##\tan(\frac{\pi}{4}\cdot 2^{-(n+1)})## as follows.

##t_0=1##
##t_{n+1}=\frac{\sqrt{t_n^2+1}-1}{t_n}## for ##n\geq 0##
--
Just replace the ##\cot(2^{-k}\cdot \alpha)## term in the other recursive sequence by ##1/t_{n}##, and it should be alright, I think.

I wrote some code for this again, but it seems to stop working after ##n=13##.

Python:
def recursive_tan(n):
    """This function returns tan[(pi/4)/2^n] using direct recursion.

    Input: non-negative integer
    Output: tan[(pi/4)/2^n]

    """
    if n==0:
        return 1
    else:
        dnm=recursive_tan(n-1)
        nmr=math.sqrt(dnm**2+1)-1
        return nmr/dnm

def new_pi(n):
    """This function calculates an estimate of pi using direct recursion.
    It was derived using the est_pi_8th and hypotenuse_sequence functions,
    and the relation described by the former.

    Input: non-negative integer
    Output: estimate of pi

    """
    #Starts to diverge from intended value after n = 13#
    if n==0:
        return 2*math.sqrt(2)
    x=new_pi(n-1)/2**(n+1)
    y=1-x/recursive_tan(n-1)
    z=math.sqrt(x**2+y**2)
    return 2**(n+1)*z
 
  • #13
That works.
Eclair_de_XII said:
I wrote some code for this again, but it seems to stop working after n=13n=13.
Rounding errors. Your formula has a large cancellation in the numerator where you subtract 1 from something minimally larger than 1, that tends to amplify rounding errors.

Try ##t_{n+1}=\frac{\sqrt{t_n^2+1}-1}{t_n} = \frac{t_n}{\sqrt{t_n^2+1}+1}##. The trick here is ##a-b=\frac{a^2-b^2}{a+b}## where a is the square root and b=1. After the square root is gone the numerator can be simplified, getting rid of the cancellation. In Excel the first expression gets worse after 12 steps while the second expression leads to an error too small to calculate.

##2^n t_n## does converge to ##\frac{\pi}{4}##, indeed.
 
  • Like
Likes   Reactions: Eclair_de_XII and Klystron
  • #14
mfb said:
Rounding errors. Your formula has a large cancellation in the numerator where you subtract 1 from something minimally larger than 1, that tends to amplify rounding errors.

Try ##t_{n+1}=\frac{\sqrt{t_n^2+1}-1}{t_n} = \frac{t_n}{\sqrt{t_n^2+1}+1}##. The trick here is ##a-b=\frac{a^2-b^2}{a+b}## where a is the square root and b=1.

I see. Thank you for the tip.

mfb said:
##2^n t_n## does converge to ##\frac{\pi}{4}##, indeed.

Of course. The small angle approximation method would be the most ideal option for estimating ##\pi##, considering the nature of the sequence of angles ##\{\theta_n\}_{n\in \mathbb{N}}=\{(\frac{\pi}{4}\cdot 2^{-n})\}_{n\in \mathbb{N}}## used for the estimation. That is to say, the nature of the sequence used to substitute the ##\tan## function evaluated at these angles.

Since ##\theta_n\rightarrow 0## as ##n\rightarrow \infty##:

(1) ##\sin(\theta_n)\rightarrow \theta_n##
(2) ##\cos(\theta_n)\rightarrow 1##

Hence,

##\lim_{n\rightarrow \infty} t_n = \lim_{n\rightarrow \infty} \tan(\theta_n)=\frac{\lim_{n\rightarrow \infty} \sin(\theta_n)}{\lim_{n\rightarrow \infty} \cos(\theta_n)} \\ =\frac{\lim_{n\rightarrow \infty} \theta_n}{1}=\lim_{n\rightarrow\infty} \theta_n=\lim_{n\rightarrow\infty}(\frac{\pi}{4} \cdot 2^{-n})##

Thanks for the insight.
 
Last edited:

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
Replies
0
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 125 ·
5
Replies
125
Views
20K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 17 ·
Replies
17
Views
5K