SF
Description
Calculates the Superformula for any angle Phi from Phi = 0 degree to Phi = 360 degrees. http://en.wikipedia.org/wiki/Superformula
Sample input
Using these values the superformula should give a figure looking like a circle: a=b=1; n1, n2, n3 and m are equal to 2
How the code works
For quick input the values for n1, n2, n3 and m are preset with value 2 but can instead be overwritten if different.
Then in P0 the angle is set to 0 degree and is incremented by 1 at the ending of the program.
To obtain a full circle the Memory Register 06 ( MR06 ) is set to the end value " 360 ". (In run mode "MR06" is actually to enter to recall the memory register for register 06.)
Sample output
The program generated coordinate pairs, as pasted and copied out of the printer simulation:
File Attach:sf.1.txt Δ :
+X= +Y= 1.0000 0.0000 0.9998 1.0000 0.9994 0.9998 0.9986 0.9994 0.9976 0.9986 0.9962 0.9976 0.9945 0.9962 ... 0.9986 0.9976 0.9994 0.9986 0.9998 0.9994
Interpretation
Here the angle Phi runs through a full rotation if register MR06 is set to the value 360.
Program
The program file contains the two programs P0 and P1, that looks like this: Attach:SF360.pf Δ
***P0 MAC 0 Min0F 360 Min06 “N1?” PAUSE 2 HLT Min01 “N2?” PAUSE 2 HLT Min02 “N3?” PAUSE 2 HLT Min03 “M?” PAUSE 2 HLT Min44 1 Min08 1 Min09 “+X= +Y=” GSBP1 LBL0 MR0F × MR44 = ÷ 4 = Min05 cos ÷ MR08 = abs X^y MR02 = Min07 MR05 sin ÷ MR09 = abs X^y MR03 = M+07 MR07 X^y ( MR01 ± 1/x ) = P→R MR0F = FIX4 “; #” = X↔Y FIX4 “; #” GSBP1 0 Min07 1 M+0F MR06 x=F GOTO1 GOTO0 LBL1 “End.” ***P1 SAVE invEXE
Memory registers
While using the same variable names as in the Wikipedia article, the memory registers are set as follows:
M01 n1 M02 n2 M03 n3 M44 m M05 m*Phi/4 M06 361 M07 r M08 a M09 b M0F Phi
Here the simulator does not like M04 that I use M44. This requires to set the calculator into Mode .45 and will reduce the number of free program steps while more registers become available.
Warning
As it turns out the resulting data file does not respresent points on just one circle: The image shows a small elipse.
File Attach:sf360.gif Δ
To the developer
The display cannot hold both coordinates at the same time that the values are scrolled through which is very time consuming. I suggest you to code a switch in the simulator for allowing to turn off the display of to be printed values, while the display can show a counter value instead.