[Cuis-dev] [Ann] First sketch of Cuis 6.1 release - Please REVIEW and TEST!
Juan Vuletich
juan at cuis.st
Tue Jan 2 06:30:36 PST 2024
On 1/2/2024 8:46 AM, Hilaire Fernandes via Cuis-dev wrote:
>
> Nice.
>
> I guess you think about the next step, to introduce them how to
> simulate these two historical approaches with programming.
>
We did it with code. We say that the first one only involved Integer and
Fraction, and why the second required Float.
> You may want to even write it visually, you will find examples in
> DrGeo Smalltalk Sketch for pi approximations.
>
> 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.
>
> So written only in English, this gives these instructions:
>
Nice. We didn't do any visualizations. This is my version of the code:
n := 5.
[ n < 20000] whileTrue: [
r := n.
total := (2*n+1) * (2*n+1).
count := 0.
n negated to: n do: [ :x |
n negated to: n do: [ :y |
y squared + x squared <= r squared ifTrue: [
count := count + 1 ]]].
{n. (count / total * 4). (count / total * 4)
printStringFractionDigits: 40} print.
n := n * 12 // 10.
].
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.
I think I'll use DrGeo next time, and show your randomized version. The
animation / visualization is a cool extra.
> Regarding the Archimedes methods, I have examples. It is easier to
> implement as you can ask DrGeo the length of the regular polygon.
>
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.
My version of this code is
p1 := 1 at 0.
p2 := 0 at 1.
cantidadSegmentos := 4.
25 timesRepeat: [
largoSegmento := (p2 - p1) rho.
perimetro := largoSegmento * cantidadSegmentos.
pi := perimetro / 2.
{cantidadSegmentos. pi } print.
cantidadSegmentos := cantidadSegmentos * 2.
p2 := p1 + p2 / 2.
p2 := p2 / p2 rho.
].
> In both examples, the user observes visually what is going on with
> animation.
>
> Hilaire
>
> Le 02/01/2024 à 11:59, Juan Vuletich via Cuis-dev a écrit :
>> 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.
> --
> GNU Dr. Geo
> http://gnu.org/s/dr-geo/
> http://gnu-drgeo.blogspot.com/
Cheers,
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240102/2bb437f7/attachment.htm>
More information about the Cuis-dev
mailing list