Teaching simple programming and Monte Carlo methods with Geogebra CAS
I want to incorporate more programming to my math lessons & I wanna do this with Geogebra.
So lets say that I want to simulate this simple problem:
Roll two D20 dice. What is the probability that the geometric mean of these two dice rolls is a integer?
If possible, I want to do the following commands in CAS-view.
Geogebras Algebra has this variable: numberofsuccess:= 0
And now in to CAS-view
LINE 1. // a:=RandomBetween(1 ,20)
LINE 2. // b:=RandomBetween(1 ,20)
LINE 3. // sqrt(a*b) - floor( sqrt(a*b) )
LINE 4. // if( $3==0, numberofsuccess:=numberofsuccess +1 )
LINE 5. // command that repeats LINES 1-4 2500 times ??
LINE 6. // after this I can just do the division: numberofsuccess/2500 ... ... ...
OK the ROW 4 does not work because Geogebra "does not understand" c:=c+1 ... so first of all how do I do ROW 4? Can I utilise lists or spreadsheet in doing this?
Thanks already for your help.