I am new to graphic calculators and am working my way through the TI-83 plus manual. I got to the Sierpinski triangle example on page 17-7. It worked as expected but I thought I would investigate what is happening with some of the calculations. Instead of a random numbers for X, Y, and N, I put in a starting value of 1 for X and Y and a constant of 0.2 for N. I also shortened the loop to only a dozen of iterations or so. With the N less than 1/3, the X and Y values should be halved for each iteration. This is true for X, but Y goes to zero after the first go around. This makes no sense to me. I tried a bunch of different changes to see why. Curiously, when I use another variable letter throughout the program rather than Y, it works just as expected showing a halved value for both X and the second variable.
While the program works as presented in the text with random numbers, I sure would like to know what is happening when one uses the variable Y so I can be confident in my results for future programming applications. There must be something I am missing. Thanks in advance for any insight. Code is below for both the original and modified program.
ORIGINAL PROGRAM
Code:
MODIFIED PROGRAM
Code:
While the program works as presented in the text with random numbers, I sure would like to know what is happening when one uses the variable Y so I can be confident in my results for future programming applications. There must be something I am missing. Thanks in advance for any insight. Code is below for both the original and modified program.
ORIGINAL PROGRAM
Code:
PROGRAM:SIERPINS
:FnOff :ClrDraw
:PlotsOff
:AxesOff
:0→Xmin:1→Xmax
:0→Ymin:1→Ymax
:rand→X:rand→Y
:For(K,1,3000)
:rand→N
:If N≤1/3
:Then
:0.5(0.5+X)→X
:0.5(0.5+Y)→Y
:End
:If 1/3<N and N≤2/3
:Then
:0.5(0.5+X)→X
:0.5(1+Y)→Y
:End
:If 2/3<N
:Then
:0.5(1+X)→X
:0.5Y→Y
:End
Pt-On(X,Y)
:End
:StorePic 6
MODIFIED PROGRAM
Code:
PROGRAM:SIERPINS
:FnOff :ClrDraw
:PlotsOff
:AxesOff
:0→Xmin:1→Xmax
:0→Ymin:1→Ymax
:1→X:1→Y
:For(K,1,12)
:.2→N
:If N≤1/3
:Then
:0.5(0.5+X)→X
:0.5(0.5+Y)→Y
:End
:If 1/3<N and N≤2/3
:Then
:0.5(0.5+X)→X
:0.5(1+Y)→Y
:End
:If 2/3<N
:Then
:0.5(1+X)→X
:0.5Y→Y
:End
Pt-On(X,Y)
:End
:StorePic 6