<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 1/2/2024 8:46 AM, Hilaire Fernandes via Cuis-dev wrote:
<blockquote cite="mid:a56d59f9-8e53-46aa-b9dc-b86b49d7e4ab@free.fr"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<p><font size="4">Nice.</font></p>
<p><font size="4">I guess you think about the next step, to
introduce them how to simulate these two historical approaches
with programming.<br>
</font></p>
</blockquote>
<br>
We did it with code. We say that the first one only involved Integer
and Fraction, and why the second required Float.<br>
<br>
<blockquote cite="mid:a56d59f9-8e53-46aa-b9dc-b86b49d7e4ab@free.fr"
type="cite">
<p><font size="4"> </font></p>
<p><font size="4">You may want to even write it visually, you will
find examples in DrGeo Smalltalk Sketch for pi approximations.<br>
</font></p>
<p><font size="4">The Spanish DSL will help a bit to write DrGeo
commands in Spanish, however the Smalltalk extentions I
translated in French are not yet translated to Spanish.</font></p>
<p><font size="4">So written only in English, this gives these
instructions:<br>
</font></p>
</blockquote>
<br>
Nice. We didn't do any visualizations. This is my version of the
code:<br>
<br>
n := 5.<br>
[ n < 20000] whileTrue: [<br>
r := n.<br>
total := (2*n+1) * (2*n+1).<br>
count := 0.<br>
n negated to: n do: [ :x |<br>
n negated to: n do: [ :y |<br>
y squared + x squared <= r squared ifTrue: [<br>
count := count + 1 ]]].<br>
{n. (count / total * 4). (count / total * 4)
printStringFractionDigits: 40} print.<br>
n := n * 12 // 10.<br>
].<br>
<br>
Each of them had to write their own, but with a glimpse at mine.
This way each of them had to do real work, but didn't feel lost.<br>
<br>
I think I'll use DrGeo next time, and show your randomized version.
The animation / visualization is a cool extra.<br>
<br>
<blockquote cite="mid:a56d59f9-8e53-46aa-b9dc-b86b49d7e4ab@free.fr"
type="cite"><font size="4"></font>
<p><font size="4">Regarding the Archimedes methods, I have
examples. It is easier to implement as you can ask DrGeo the
length of the regular polygon.</font></p>
</blockquote>
<br>
Well, my focus was on using as little as possible, and implement
everything, to get an understanding of how computers actually do
stuff. On our first session we had done square root, only assuming
the 4 elemental operations.<br>
<br>
My version of this code is<br>
<br>
p1 := 1@0.<br>
p2 := 0@1.<br>
cantidadSegmentos := 4.<br>
25 timesRepeat: [<br>
largoSegmento := (p2 - p1) rho.<br>
perimetro := largoSegmento * cantidadSegmentos.<br>
pi := perimetro / 2.<br>
{cantidadSegmentos. pi } print.<br>
cantidadSegmentos := cantidadSegmentos * 2.<br>
p2 := p1 + p2 / 2.<br>
p2 := p2 / p2 rho.<br>
].<br>
<br>
<blockquote cite="mid:a56d59f9-8e53-46aa-b9dc-b86b49d7e4ab@free.fr"
type="cite">
<p><font size="4">In both examples, the user observes visually
what is going on with animation.<br>
</font></p>
<p><font size="4">Hilaire<br>
</font></p>
<div class="moz-cite-prefix">Le 02/01/2024 à 11:59, Juan Vuletich
via Cuis-dev a écrit :<br>
</div>
<blockquote type="cite" cite="mid:6593EC7A.9010107@cuis.st">For
the second session I wanted to play with real numbers, so we
tried two ways of computing Pi. The first one was to "draw" a
circle on a grid, and take the number of points in the grid that
lie inside the circle (using the x^2+y^2 <= r formula),
divide that by the total number of points. And do that for
increasingly larger grids, to improve the approximation. This
one is interesting because it only uses integers. But it is
slow. Then we tried another method, that is the perimeter of an
inscribed polygon of increasing number of sides. This later one
can be done without trigonometry, but it requires sqrt() to
normalize the vertexes, hence Float. These are way more
complicated things that what we did before, so I went slower,
and explained my solution on my computer as I guided them on
writing their own. So I didn't push them too much and they
didn't get frustrated. I guess the ability to write the solution
completely on their own requires a bit more time and practice,
and my objective is to engage them, not scare them. They still
could really understand what we were doing, and appreciate the
kind of thinking involved.<br>
</blockquote>
<pre class="moz-signature" cols="72">--
GNU Dr. Geo
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://gnu.org/s/dr-geo/">http://gnu.org/s/dr-geo/</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://gnu-drgeo.blogspot.com/">http://gnu-drgeo.blogspot.com/</a></pre>
</blockquote>
<br>
Cheers,<br>
<pre class="moz-signature" cols="72">--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
</body>
</html>