GreatPyramid.frink

View or download GreatPyramid.frink in plain text format


/** This program solves a speculation from an offhand comment in a documentary,
    which said that if the Great Pyramid of Giza was disassembled, you would
    have enough stone to make a wall around France.

    This uses Frink's symbolic solving capabilities to solve a system of
    simultaneous equations and find the cross-sectional area of a wall that
    you could build.  It treats France as an approximate hexagon.

    Spoiler:  The result is that you'd have a wall with cross-section of about
    0.82 m^2, which is a fairly good wall.  If it were as tall as the average
    section of the Berlin Wall (3.6 meters or 12 ft),
    it would be about 22 cm (9 inches) thick!   That's a fairly good wall!
*/

use systemSolver2.frink
symbolicMode[true]
showApproximations[false]
showDimensionName[false]

// Create a system of simultaneous equations and let Frink rearrange
// and solve it.
pyramid = new System[[v === base1 base2 height / 3,   // Volume of rect pyramid
                      base1 === base2,             // Base of pyramid is square
                      perimeter === 6 hexside,        // Perimeter of hexagon
                      area === 3/2 sqrt[3] hexside^2, // Area of hexagon
                      wallvolume === v,
                      wallcrosssection === wallvolume / perimeter,
                      wallthickness === wallcrosssection / wallheight],
                      []]

// Show all solutions to show off
println[join["\n",pyramid.solveAll[]]]

// Plug in exact numbers and solve for the wall's cross section.
println["Solutions:"]
dsols = pyramid.solveForValues["wallthickness",
                                 [["height", 455 feet + 5 in],
                                  ["base1", 755 feet + 7 in],
                                  ["area", 247368 miles^2],// Area of France
                                  ["wallheight", 12 ft]]] 
println[join["\n\n",eval[dsols]]]


View or download GreatPyramid.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17592 days, 15 hours, 21 minutes ago.