Zhao Youqin's algorithm is an algorithm devised by Yuan dynasty Chinese astronomer and mathematician Zhao Youqin (, ? – 1330) to calculate the value of in his book Ge Xiang Xin Shu ().

Algorithm Zhao Youqin started with an inscribed square in a circle with radius r.Yoshio Mikami, Development of Mathematics in China and Japan, Chapter 20, The Studies about the Value of etc., pp 135–138

If denotes the length of a side of the square, draw a perpendicular line d from the center of the circle to side l. Let e denotes r − d. Then from the diagram:

Extend the perpendicular line d to dissect the circle into an octagon; denotes the length of one side of octagon.

Let denotes the length of a side of hexadecagon

similarly

Proceeding in this way, he at last calculated the side of a 16384-gon, multiplying it by 16384 to obtain 3141.592 for a circle with diameter = 1000 units, or

He multiplied this number by 113 and obtained From this he deduced that of the traditional values of , that is 3, 3.14, and , the last is the most exact.Yoshio Mikami, p136

See also Liu Hui's algorithm

References