Teaching Kids Programming – Silver Ratio and Pell Numbers (Metal Quadratic Equation)


Teaching Kids Programming: Videos on Data Structures and Algorithms

We know the Golden Ratio tex_05737271a52d92eb068dd7d462bc0e3a Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) is defined as the fraction tex_5079599deb792f52fb30dcfcef189566 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) where tex_c5e91c848e355afe85b3a3371eda0a63 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) if we set tex_ba276bbe9e49f6d2b57bfee4917506e4 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) then tex_d35ae76ff4f7f8da4da4f3cde6579973 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)

Quadratic function tex_32f53a7aefd994df67fec738e0b29aab Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation), we know there are two roots to quadratic equation tex_d16ae3d3d796536d7d7f311555068bcb Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)

Root 1: tex_914e40c8219e04cbbc8e00bd5f14ce28 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)
Root 2: tex_d27e174b8867e01f0eacdb3dd3c18744 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)

We take the positive root which is tex_50da74edaab1ce2e852964e5f6eb00a6 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) which is approximately 1.618

We also learned previously that the golden ratio exists in the Fibonacci numbers:

tex_64ee51adbc0c385038006a3fe4ade5f8 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)

Metal Quadratic Equation

Let’s define the quadratic equation tex_40c95ab7e1520d7915f6eeba1180c25a Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) the metal ratio equation:

when tex_a533da8e1868aabc5aeb352ced479d91 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) we have the Golden Ratio tex_05737271a52d92eb068dd7d462bc0e3a Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)
when tex_0265fe96355bcda11c9fe873a3d1abba Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) we have the Silver Ratio which is tex_1f7a9e40a6d4baa863f5b70dad6de7f4 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)
when tex_488afa96d1b4df5f530ced0e66ab2575 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) we have the Bronze Ratio.
and so on…

The (positive) root for the metal quadratic equation is:

tex_7ed1469d9a4451405f7cb3cbfdc6af6b Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation), which can be rewritten as the continued fraction:

tex_8b400184ca666796ae579d4f2882a45d Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)

Pell Number and Silver Ratio

Let’s take the Silver Ratio Equation: tex_b57221c56fd4d721bae92e7dd762dab9 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)

We can solve the positive root is tex_d05a173160477ffa98e29575f7aefe20 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) which is approximately 2.414

The Pell Numbers are quite similar to Fibonacci numbers except each number in the Pell Number sequence is equal to two times its previous number plus the one before:

tex_1e6bd6740d406739c26ad1f2d80031da Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)
where the first two Pell numbers are:
tex_c175379f353e8a31ee5b80b971603ff8 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)
tex_66ed99a6ace7f945a78acaf199d4f91e Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)

The first few Pell Numbers are: 0, 1, 2, 5, 12, 29, 70, 169, … (if the first two numbers are both 2, then we have Pell-Lucas Numbers)

If we keep going on..

tex_ec906ffcc21365fb87d648779330146a Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) which is the silver ratio tex_1f7a9e40a6d4baa863f5b70dad6de7f4 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)
aka.
tex_131d415541b9607183e3f8ed3fee01ca Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation)

So, we can use this method to estimate the value of the silver ratio tex_1f7a9e40a6d4baa863f5b70dad6de7f4 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation) also the value of the square root of two tex_d88df3f5d32607ef51e2cc33c99af4b1 Teaching Kids Programming - Silver Ratio and Pell Numbers (Metal Quadratic Equation).

Compute Pell Number in Recursion

We can implement the Pell Number (similar to Fibonacci Number) in Recursion and then can be improved with memoziation which makes it Dynamic Programming Algorithm (Top Down).

@cache
def pell(n):
    if n == 0:
        return 0
    if n == 1:
        return 1
    return 2*pell(n - 1) + pell(n - 2)

Most modern compilers will probably optimise this into the iterative manner:

def pell(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b, 2 * b + a
    return a

–EOF (The Ultimate Computing & Technology Blog) —

1569 words
Last Post: Teaching Kids Programming - Solving Math Equation n*n+19*n-n!=0 (Factorial Function and Unbounded Bruteforce Algorithm)
Next Post: Teaching Kids Programming - Introduction to Kruskal's Minimum Spanning Tree (Graph Algorithm)

The Permanent URL is: Teaching Kids Programming – Silver Ratio and Pell Numbers (Metal Quadratic Equation) (AMP Version)

Leave a Reply