David Wells was born in 1940. He had the rare distinction of being a Cambridge scholar in mathematics and failing his degree. He subsequently trained as a teacher and, after working on computers and teaching machines, taught mathematics and science in a primary school and mathematics in secondary schools. He is still involved with education through writing and working with teachers. While at university he became British under-21 chess champion, and in the mIddle seventies was a game inventor, devising 'Guerilla' and 'Checkpoint Danger', a puzzle composer, and the puzzle editor of Games & Puzzles magazine. From 1981 to 1983 he published The Problem Solver, a magazine of mathematical problems for secondary pupils. He has published several books of problems and popular mathematics, including Can You Solve These? and Hidden Connections, Double Meanings, and also Russia and England, and the Transformations of European Culture. He has written The Penguin Dictionary of Curious and Interesting Numbers and The Penguin Dictionary of Curious and Interesting Geometry, and is currently writing a book on the nature, learning and teaching of mathematics.
One of the first topics he deals with is Egyptian Fractions which consist only of unit fractions, meaning fractions with a numerator of 1. For example, the Egyptians would have expressed the fraction 710 as 12+15.
The author then asks the question:
Can all proper fractions be expressed as the sum of unit fractions, without repetition?
The answer is:
Yes, as Fibonacci showed, also in his Liber Abaci, where he described what is now called the greedy algorithm. Subtract the largest possible unit fraction, then do the same again, and so on. Sylvester proved in 1880 that applying this greedy algorithm to the fraction pq, where p is less than q, produces a sequence of no more than p unit fractions.
The site CODESDOPE provides the Python code to generate an Egyptian fraction from an improper fraction. Here is the code, applied to the fraction 57, together with its output:
import mathunit_den_array = [0]*10iter = 0
def gcd(a, b):c = a%bwhile(c > 0):a = bb = cc = a % breturn bdef greedy_egyptian_fraction(num, den):global iterif(num == 1):#appending list unit_den_arrayiter = iter+1 # storing in unit_den_array from index 1 not 0unit_den_array[iter] = denelse:unit_den = math.ceil(den/num)iter = iter+1unit_den_array[iter] = unit_dengcd_of_numbers = gcd((num*unit_den) - den, den*unit_den)greedy_egyptian_fraction(((num*unit_den) - den)//gcd_of_numbers, (den*unit_den)//gcd_of_numbers)if __name__ == '__main__':greedy_egyptian_fraction(5, 7)for i in range(1, iter+1):print(unit_den_array[i])
2570
There is a lot of code and the contrast with the amount of code needed for SageMath could not be more stark. Here is code required for SageMath to accomplish exactly the same task:
L=[]n=5/7while n>0:bottom=ceil(denominator(n)/numerator(n))L.append(bottom)n=n-1/bottomprint(L)[2, 5, 70]
While I am inclined to become more proficient in the use of Python, I am at the same time aware of how much more SageMath is suited to performing mathematical tasks, as the example of Egyptian fractions illustrate. Why go through a painful Python procedure to generate an outcome that SageMath can achieve almost effortlessly. It took me a few minutes to generate the SageMath code but I'm sure I would have struggled for much longer if I had only Python code to rely on. Here is the permalink to SageMathCell.
As the CODESDOPE observes in Figure 1:
Figure 1
My SageMath algorithm has provided the first representation but not the second. The latter is preferable in one way because the maximum denominator is much smaller (21 versus 70). Another way to generate an Egyptian fraction is by determining the Engel expansion for the proper fraction. I posted about the Engel expansion on the 26th September 2016. For an explanation of what this expansion is all about, see Figure 2.
Figure 2
The algorithm I developed to generate the Engel expansion for any positive real number is shown below, using 57 as an example (permalink):
x=5/7u=xE=[1]F=[]product=1sum=0for i in [1..10]:if u==0:breakelse:a=ceil(1/u)u=u*a-1E.append(a)product=product*asum+=1/productF.append(1/product)print("Engel expansion is",E)print("Fraction expression is",F)Engel expansion is [1, 2, 3, 4, 7]Fraction expression is [1/2, 1/6, 1/24, 1/168]
So additionally 57=12+16+124+1168. Interestingly, I discovered on this website about proper fractions of the form 4n and 3n. To quote from the site:
In the 1940s, the mathematicians Paul Erdos and Ernst G. Straus conjectured that every fraction with numerator = 4 can be written as an Egyptian fraction sum with three terms. If you have found an example that appears to need more than three, can you find an alternative sum? Can you find a reason why it must work, or a counter-example - the conjecture isn't yet proved. It is proved for 3n.
Testing this out on 37, we find an Egyptian fraction of 13+111+1231. I'm sure there's a lot more that can be said about Egyptian fractions but I'll finish up here and maybe return to the topic at a later date. Figure 3 shows how the Egyptians connected the senses with fractions that had powers of 2 as denominators.
Figure 3
It can be noted that 12+14+18+116+132+164=6364
No comments:
Post a Comment