Click the green flag. Use the 'n' slider to set n in the equation x^n + y^n =1. Watch as the script draws a filled shape, not just the curve itself, for the selected value of n. For n = 2, the equation produces the expected circle, x^2 + y^2 = 1. Ah! What does n = 1, 3, 4, 5, 6, 7, 8, 9, 10,etc. create? Be ready to be surprised!
x^2 + Y^2 = 1 is the equation of the unit circle. Most of us go through school without ever wondering what x^n + y^n = 1 looks like for different n. The French mathematician Gabriel Lamé (1795–1870) first explored the x^n + y^n = 1 equation and the Danish scientist, mathematician, architect, and poet (polymath) popularized a specific shape he called a Superellipse that is drawn for n between 2 and 3. Piet Hein also invented the famous 3D puzzle,the Soma cube. The lower left corner displays his drawing of his cube and a profound statement about problem-solving, well understood by Scratchers. This script uses the logarithm definition of base^power = answer to compute exponentiation. b^p = a log( b^p) = log(a) p log b = log a, and by the definition of a logarithm, 10^(p log b) = a The above equation is used to perform exponentiation. Programming Outline This project looks at the equation x^n + y^n = 1. First, solve the equation for y; y^n = 1 - x^n, take the nth root of both sides, y = nth root of (1- x^n) or, as I've expressed in the code, y = (1- x^n)^1/n [like √2 = 2^1/2] In the computation loop, the script performs these steps in order: (1) compute x^n, (2) compute (1 - x^n), and (3) compute (1 - x^n)^1/n The script actually computes y from x = 0 to x =1 to draw the right half and then uses symmetry to draw the half of the shape.