Georges Lemaitre and one of his favorite problems for his new students at university RRS feed

  • General discussion

  • Georges Lemaitre had his accommodation just below mine at the university. He had calculated and developed the theory of the expansion of the universe on a Moon-Hopkins mechanical calculator. A similar calculator is still at the university of Namur in Belgium. The majority of people (even wikipedia) only remember the name of one of his dementors who said, it’s like there was a big bang ... He was a catholic priest  and he told us he could talk about experience and work of the past, but that we young people could not predict the future. Often the very actual moment seemed simple and as an example he asked us to calculate a small problem. We only had some slide rules, logarithm books, and paper and a pencil. We had a week to solve this nightmare.  A decade later I won a small HP25 calculator with 50 program steps in an HP competition, solving this problem. An unpayable machine for me at that time proving the power of the first handhelp calculators bringing computers inside our homes. With the power of small basic today I present this problem to you.

    You just need to calculate the distance between the wall and a ladder so that the ladder touches the palette and the wall at the top. As an example, the length of the ladder is 5 meters and the palette of bricks 1.5 m in height and 1.2 m in width.

    Sunday, March 29, 2020 8:10 PM

All replies

  • Hi Eddy Abts, this is my first try.

    GraphicsWindow.Title = "Brick and Ladder"
    gw = 600
    gh = 600
    GraphicsWindow.Width = gw
    GraphicsWindow.Height = gh
    xo = 50
    yo = gh - 50
    ' draw floor
    GraphicsWindow.BrushColor = "Gray"
    GraphicsWindow.FillRectangle(0, yo, gw, gh - yo)
    ' draw wall
    GraphicsWindow.FillRectangle(0, 0, xo, yo)
    ' draw brick palette
    GraphicsWindow.BrushColor = "FireBrick"
    GraphicsWindow.FillRectangle(xo, yo - 150, 120, 150)
    ' draw ladder
    x1 = xo
    y2 = yo
    GraphicsWindow.PenColor = "Black"
    GraphicsWindow.PenWidth = 10
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FontName = "Consolas"
    For a = 15 To 75 Step 10
      _a = Math.GetRadians(a)
      y1 = yo - 500 * Math.Cos(_a)
      d = 500 * Math.Sin(_a)
      x2 = xo + d
      GraphicsWindow.DrawLine(x1, y1, x2, y2)
      GraphicsWindow.DrawText(x2, yo, Math.Round(d)) 

    Nonki Takahashi

    Monday, March 30, 2020 12:50 AM
  • solution by LDPhysics: LSK834

    Monday, March 30, 2020 6:01 AM
  • Hey Nonki – thanks for your nice program and the correct approach

    let's George Lemaitre tell us again why he started with this example. Behind math there is a story that we  can use to motivate people and bring fun inside science. He told us bringing a ladder inside the classroom probably would end in accidents.  So he asked us to take a paper and measure the length of the paper. There was no discussion about the decimeters, not even about the centimeters. With the millimeters the problems started. Just imagine you had to start to measure the length of the ladder, the palette, etc. We were still using wooden rulers … Finally only 2 digits were really correct the third one was just an estimate. So we could probably not rely on the final result ! (Try to compare several rulers … you will already find some different results !)

    Let’s have a look to Nonki’s first solution. The program is visualizing the problem. It’s really the right approach !

    George did it with a ruler on the blackboard, but asked us to imagine it wasn’t a ladder, but a ray of light passing behind the moon. In the program we find a sinus. No idea about the precision of this function especially with a “computer”. The first mechanical calculators,  were working with digits and afterwards the digits were kept in nibbles. Calculations were done just as on a paper and documented ! No discussion about the precision  as with 12 digit numbers and 15 digit numbers result of goniometric functions for angles approaching 0° or 90° as we find on modern calculators (all giving different results). Finding a solution only using arithmetic functions could make it possible to calculate the error on the result.  A colleague working for the NASA told me that they were using five different computers, from different constructors, different programmers, coming from different universities, programming in different  languages  to calculate the trajectories to send the first men to the moon. The last solution was a handheld calculator …on which was written “read the manual if everything fails”.

    The nice approach of Nonki’s program is to use a for next loop to control the precision. In line 23 we can change the step.

    Something as : For a = 15 To 75 Step  2 (but the program is not displaying the result).

    He could also use  inbedded  loops … approaching the ladder meter by meter and then within the interval to find de next digit decimeter by decimeter, etc. And why not using  a binary search in each interval such as in sorting programs. (Useful if the calculations are extremely complex). The way we tried with our paper and pencil as the math solution was to complex for us !  

    Remark : In europe we  calculate meter by meter ,decimeter by decimeter with a decimal system and buy our eggs by "half dozen" ! Georges would have said "to confuse the Russians". One of the favourite expressions  in the cold war period when we finished a messy math presentation.  

    • Edited by Eddy Abts Monday, March 30, 2020 9:24 AM
    Monday, March 30, 2020 8:27 AM
  • Hello Eddy Abts,

    Here is my answer used Pythagorean theorem(in China we call it "Gou-gu theorem"). Pure mathmatic method! Please suggest.

    The ID is TKK411-3.

    Best Regards & Thank you for your great story!

    Monday, March 30, 2020 10:38 AM
  • Hi Eddy, I've already written a binary search version - my second approach.  The program ID is MJZ514.

    Screen shot of a program Brick and Ladder

    This program also uses Pythagorean theorem.  In Japan, we call it "Pitagorasu no teiri" but called it "kou-ko-gen no teiri (勾股弦の定理)" in old time. 勾 means minor cathetus, 股 means major cathetus and 弦 means hypotenuse.  Off course these name are from China.

    Nonki Takahashi

    Monday, March 30, 2020 11:00 AM
  • My first look to Nonki’s version.  Once more a great example of programming. I appreciate the documentation inside the program. 

    Some variables are hardcoded ll, bw, bh – a good idea       to make it possible to change them without overloading the code.

    My apologies – On the graphics I was drawing a palette of 1.2 in height and 1.5 in width. And in the text I inversed this information.

    The calculations of the position of the drawings are done with an origin (0,0) x0 and y0 making it eventually possible to show a moving ladder with some animation … (to difficult for me)

    Something else I learned from Nonki is the use of coordinates and a map scale to position the objects.

    The first subroutine called is Sub SearchDistance. It can be a good idea to replace the variables by their value  to find out the method he is using (Up to Nonki to explain).

    In fact there are a lot of possibilities.

     Mainly moving the ladder on the x-axes and taking on the x-axes some points.

    Calculating the equation of the line with as second point the top of the palette and calculate the distance between the intersections of  x-axes and the y-axes with pythagoras.  Eventually you  can show with some dots or the end of the moving ladder or the intersections of the line with the y-axes inserting a dot with a command such as GraphicsWindow.DrawEllipse to visualize the binary search.

    Nonki was moving the ladder from right to left and found the second solution moving the ladder from left to right. Great ! A technique often used in removing spaces in MS-DOS file paths in the beginning and of at the end of a filename, leaving spaces in the middle, with a for next loop using  +1 as  step from the beginning and  -1 as step from the end.

    Lets have a look to the example of Thaelmann. If I have a look to the programs he posted in the begin of the week it’s really fabulous. Using the graphics window and an inputfield was a great idea. Inserting the Pythagorean theorem as a subroutine and some math functions is showing his interest creating more sophisticated programs. I think he found the link to  that I have still to study every day.

    I like the mix of the math instructions and the turtle.

    Jumping out of a while loop with a goto statement can be dangerous. Some programlanguages are keeping a stack with the return commands and a goto statement don’t respect the order where the whileloop has to go. A goto can be interesting to interrupt a program redirected to a program.end routine kleening up unpredicted situations. On the graphics and textscreens in the upper rightcorner there is a “x” you can use to abort  a program … often you can also use ctrl-C

    The syntax of the while statement : While (“true”) is giving a problem, because it is always true ! So you will start a endless loop. You first have to give a value to x … (x=0). Normally you have a condition something as  While x<5 and inside the whileloop you can change the value. Once the value is evaluated as  False the program wil jump behind the Endwhile statement. In our case something as x=99

    … I was lucky Nobody was coming up with the horrible mathematical formulas but if you want I can give you the file equations and a numerical example ... 

    Hey Nonki, I met a lot of famous japan climbers in Chamonix, five of them in the northface of walkerspur on grand Jorasses. Some others on Dhaulagiri (8172m) their favorit mountain-group in Nepal. Very tenacious people who never abandoned their project and I didn't know Pithagoras was a good old friend we all had in common. 


    Monday, March 30, 2020 3:50 PM
  • Hallo Eddy Abts,

    I'm not sure what to change ... Is that so? TKK411-1

    Best Wishes.

    p.s. I have read your biography. Your experience is admirable.

    Tuesday, March 31, 2020 3:48 AM
  • I will try to find some time this evening. The real gourous of small basic today are Nonki, Jan, Litdev, Ed price and a lot of others who developed this language and are active on this forum. With small basic you find back the enthusiasm and knowledge of the beginning - the manual of Ed price (see link in a previous reply) is a great example.  It was a present I received a year ago, from a famous climber, but the one who was writing the book with the IP-standard for Alcatel. Ed's book is very similar to the manuals of the HP85, we developed in the seventies and the reason I am trying to learn today programming with small basic. The languages I used at work are or no-more available, unpayable, to complex, and don't have  window-graphics and I was missing the computer solving techniques so much ...    

    So as retiree since 2006 I don't have any experience in programming window-graphics screen and animation, etc.  I have still to learn a lot and  I am passing hours to understand some lines of the program examples (especially those of nonki )- but this programs are just marvelous. Try to replicate them is what they called "a sweet dream".     

    • Edited by Eddy Abts Tuesday, March 31, 2020 10:21 AM
    Tuesday, March 31, 2020 10:20 AM
  • Hello Thaelmann,

    I was just trying another approach with your program. But me too I am just a beginner with small basic so I hope Nonki, Jan, etc will give some comments.

    I was publishing a (trial) QGP868

    Normally I start a program with some variables I need to setup the screen, etc who needs to be changed using a computer with another screen.

    Then I start the MAIN PROGRAM. A succession of some subroutines and a final line Control.buttonclicked=Buttondown

    This control statement is waiting you are clicking a button from the graphics-screen and will start to execute the subroutine Buttondown. Once the subroutine is finished, control is giving back and the program will wait again … so there is no end program at that moment.

    Then I put in place the buttondown subroutine.

    The first Topic is to identify the button that was hit.  And with an if/then statement write the code corresponding with this button. I am using the textwindow to follow the program. 

    I will document perhaps this evening how to solve the ladderproblem.

    'Written by Thaemann-Pioniere -Initializing The Program
    GraphicsWindow.Title="Lemaitre Question"
    Controls.ButtonClicked= ButtonDown 'execute the subroutine Buttondown when a Button is hit
    'End Main Program
    sub SetUpArray 
    Field[3]="Box=Texte;Texte=LadderLength : ;TH=380;TV=45;color=Blue"
    sub SetupGraphicsWindow
      For C1=3 to 5
        If Field[C1]["Box"]="Rectangle" Then
          GraphicsWindow.FillRectangle(Field[C1]["BH"], Field[C1]["BV"],Field[C1]["BHS"], Field[C1]["BVS"])
        elseif Field[C1]["Box"]="Texte" Then
          GraphicsWindow.DrawText(Field[C1]["TH"], Field[C1]["TV"],Field[C1]["Texte"])
        elseif Field[C1]["Box"]="Input" Then 
          Controls.SetSize(Btn["C1"],Field[C1]["BHS"], Field[C1]["BVS"])
        elseif Field[C1]["Box"]="Exec" Then 
          Controls.SetSize(Btn["C1"],Field[C1]["BHS"], Field[C1]["BVS"])
    SUB ButtonDown 'Subroutine that is waiting Btn is hit
      TextWindow.WriteLine("cap ="+cap+"=")
      TextWindow.WriteLine("B4 ="+Btn[4]+"=")
      if cap="Done" then 
    SUB Calculations
        TextWindow.WriteLine("Ladderlength = "+  Ladderlength)
        TextWindow.WriteLine("Start calculations")

    Something more personal : The problem, when I am teaching, are the students “always” asking new functions … So I am keeping the information in an array … using Box to specify what I plan to do. The main advantage is adding or changing some fields (using another language such as French, etc) is done just in the array and by adding a new if/then in the Buttondown subroutine.

    An example is the program DPG364. This program was a real mess  because the first idea was to take a GPX file, (xml file coming from a GPS) and to remove information such as time, heartbeat, etc you don’t want to communicate on internet. So I was writing it with hardcoded variables – Then I tried to use the graphics screen with two “toggle”buttons to activate “Time” and “Cmt” (Comments) and the executing program with a “exec”button  “GPXCleaner” to start the program. But students asked me other possibilities. Such as removing the name of the waypoints, to change automatically by numbers so that you can go from point 1 to 2 etc. Then keeping the screen information in a file, etc.

    So I tried keeping this information in an Array "Field" … Afterwards making some changes could be done just by editing the array, and ... adding an if/then bloc in the buttondown subroutine and write the subroutine to execute the “exec”choice.

    But … today the program has more than 2000 lines and is still a mess, mainly because it is becoming too complex and I am still in trouble with small basic syntax in some routines I have still to add. I just copied in the DPG364 program the screen part – there are the toggle fields to make a choice and other buttons to execute the different parts, but I was removing this routines. The complete program is running fine – but I am just in trouble to read the inputfile when this xml file is sequential (but there are workarounds).   

    Hoping this program is giving you some new ideas   

    • Edited by Eddy Abts Wednesday, April 1, 2020 11:37 AM
    Wednesday, April 1, 2020 11:29 AM
  • Hallo Eddy Abts,

    Maybe I know too little-I haven't seen a program with such an array! But it's a really good idea.

    Looking forward to a complete program.

    Best Regards.

    p.s. Is here an error?

    For C1=3 to 5

    I think the correct version is:

    For C1=1 to 5

    Wednesday, April 1, 2020 2:09 PM
  • Hello Thaelmann,

    Oh yes, thanks. It's clear normally there was a loop : for 1  to TotalNmbOfFields.

    Drawing the rectangle was not really my priority. The input and exec buttons are always a problem for me, and   I need to look in the manuals to find the syntax. The reason I was putting this stuff in an array so I just have to add a line in the array ...  

    I didn't had a lot of time - so I will just explain the mathematical part of the problem and as now you are an expert in graphics screen handling you can create a field with the distance of the ladder from point O,O in your graphics window making something as a High/Low game and why not as the hangman game. The math explication is NTX203 You have just to change line 1 - give a try with xA=2 and then try xA=3 ... If you find de number of meters you can try 2.5 (half the interval between 2 and 3 ... and than (perhaps between 2 and 2.5 or 2.5 and 3 ! good luck ... and the winner is ??? if you don't know this game

    If you want to verify take the marvelous solution of Nonki MJZ514 - and replace bw=150 and bh=120

    xA=2.0  'A is the point of the ladder on the floor x-axes  (2.02..)
    xB=1.50  'B is the point on top of the palette
    'xC and yC are the coordinates of the intersection C between the line and the y-axes
    sub DistanceAtoC
    'Line equation : y=mx+p
    m=(yB-yA)/(xB-xA)   'm=slope
    p=yA-(m * xA) 'p=y-mp and yA=0
    p=-m * xA
    TextWindow.writeline ("line-equation : y = "+m+" x + "+p)
    xC=0     'Cintersection with y-axes  
    yC= p  
    TextWindow.writeline ("xC=0 and yC = "+yC)
    Hypothenusa= math.SquareRoot(xA*xA + yC*yC)
    TextWindow.writeline ("Hypothenusa : "+Hypothenusa) 
        If Hypothenusa >Ladderlength Then     
        TextWindow.writeline ("Move Ladder XA to the Right increasing xA")
        TextWindow.writeline ("Move Ladder XA to the Left decreasing xA")


    • Edited by Eddy Abts Wednesday, April 1, 2020 6:58 PM
    Wednesday, April 1, 2020 5:22 PM
  • calculate in a for loop xa=2 to 3 ...  >>>  solution between 2.0 and 2.1

    calculate for loop xa=2. to 2.1 step 0.1  >>> 2.03 and 2.04

    calculate for loop xa=2.03 to 2.04 step 0.01  >>> 2.034 and 2.035

    continu till necessary accuracy

    Jan [ WhTurner ] The Netherlands

    Wednesday, April 1, 2020 5:48 PM
  • Hallo Eddy Abts,

    Dank u voor uw antwoord.

    My math is just a beginner level, so understanding this program is a bit difficult for me. However, I still understand a bit based on the content of the post: Is this like a pendulum, constantly narrowing the scope and improving the accuracy?

    Jan's post helps me.

    Hope my opinion is correct.

    Best Regards & Thank you.

    p.s. I can't watch the video on YouTube, so can you tell me the content of the video?
    Thursday, April 2, 2020 3:22 AM
  • Hi Eddy Abts, can I write a blog (for Small Basic Blog) about this thread?  I think it’s very interesting.  Thanks.

    Nonki Takahashi

    Sunday, April 12, 2020 12:17 PM
  • It's an honor for me ! But I have a problem … I took back the solution … after your superb 
    program it’s difficult to find another approach. My idea was to simulate the ladder and with a 
    lack of experience with small basic I was going in trouble trying to write something I did in the
     past with HP Technical Basic (HPTB). In HPTB it takes  2 lines to draw the coordinates the tics, numbering,etc …). Luckily there was one of your examples ! 
    Drawing a moving line, representing the ladder was another challenge I solved with shapes. 
    Finding the solutions was another topic … The technique is to find the smallest differences between the linelength and the hypothenusa  … I made somewhere a mistake probably taking the bad variable – ok - So it was the moment  to test “functions” to debug – after a lot of studying and testing I discovered the power of the “ld-function” command. I found back one the last “releases” where I was just implementing the "function" statement  but creating a big problem finding the smallest differences. I published it as HPW478 I did a test to draw a dot at 5m from the Ax point  on the line with the drawellipse statement so that the dots were staying on the screen drawing a line … etc. I still want to include this routine in the program. 
    Yes but … I still had to finish some other programs and “functions” giving me now the opportunity to make the results of  these programs mathematically much more readable for the students. So the ladderproblem  was classified as “something for next weeks”.  Before making the changes I got 1.77/4.67 and with your program 1.77/4.57 (a 5 in stead of the 6 ?).  Probably I will have some time next week (14 april). If you send me a mail I can reply the pictures.     Thanks for your interest.

    • Edited by Eddy Abts Sunday, April 12, 2020 5:28 PM
    Sunday, April 12, 2020 5:12 PM
  • Hi Eddy, I modified your program a little and published as HPW478-0.

    • a path must be full path for Small Basic
    • changed timing to remove a ladder for no flicker

    And I found your program could calculate following answers.

    Ax= 1.767
    dif = 0.00231...

    Ax= 4.568
    dif = 0.00029...


    Nonki Takahashi

    Monday, April 13, 2020 3:27 AM
  • Eddy, I wrote the blog.  Thanks.

    Ladder Problem by Georges Lemaître - Small Basic Featured Thread

    Nonki Takahashi

    Monday, April 13, 2020 4:32 AM
  • I just finished another release .... in next reply !  QXL006

    Hello Nonki, Litdev, Jan and all the others making small basic fun !

    Especially I would like to thank Nonki for his examples and his precious advice.
    Because of the coronavirus I have a lot of work, this is not the topic, but today I found too little time to really finalize 
    the program as I wanted.
    I was putting a maximum of routines in subroutines, to make the flow easier to follow. The point A are the points 
    on the x axis, B the tip of the palette, C the intersection with the y axis, D with the line y in the point x = -1 and
     L the tip of the Ladder. I wanted a different approach, closer to reality by visualizing the movement of the top of the
     ladder. It’s the red line drawn by  point L and detect the moment that the sign of the difference between the

     hypotenuse and the length of the ladder is changing when the top is  passing above the y axis.  Info is send to the

    debugfile.  Set the debugflag to sending the solutions to the textwindow. There is still a problem with the debug … but time is missing. The program is published as BFR561

    variable but time is missing ... The program is published as BFR561.

    • Edited by Eddy Abts Wednesday, April 22, 2020 8:28 AM
    Sunday, April 19, 2020 6:35 PM
  • For the ladderproblem I changed "Debug" in "info“ because I am not especially tracing syntaxerrors but "information". The program is published as QXL006.

    First change info=0 to info=1 and info=2Once the “infofile.txt” is present you can open the file and see the file growing each time the buffer is emptied. As the file is open the deletefile command will empty the file and start automatically to follow the writings.    

    I opened another question "Debugging - following and modifying the programflow" to follow the flow of a program with functions and notepad++ using the ladderproblem as example

    Nonki told me to use notepad++ to follow the writings in an open file.

    First you need the installer with the executables to install from notepadsite

    Try a search on “ npp.7.Installer.exe”

    to find the “correct” site

    Normally you  will find in the plugins tab => “Plugins admin” and – The “Document Monitor” who  needs to be present otherwise you need to install the “” file and to flag it.  

    I was also writing a quick and dirty program “Cleaner” to remove the "harmfull remarks" when importing a program such as “QXL006” The program will create a new file “  You just need to add as last commentline  'END PROGRAM  

    This program is published as HTH609. Up to you to verify BEFORE if some harmful lines are present.


    • Edited by Eddy Abts Wednesday, April 22, 2020 12:12 PM
    Wednesday, April 22, 2020 8:27 AM