Here are my final versions. I've stuck with my first approach, but I'd like to thank Gilles for his compact version and improvements, Han for his suggestion and those of you who were curious enough to give it a try on other calculators.
The shape can be changed at will on both calculators. For y = x^2, just remove one of the srqt characters, or replace them with 3 SQRT for y = x^3. In this case, the time parameters (15.2 and 57.2 in the HP-48GX program) will need to be adjusted properly.
HP-48G/GX
Code:
%%HP: T(3)A(D)F(.);
\<< HMS\-> 60 * 15.2 -
57.2 / \-> t
\<< RCLF -40 CF
# 131d # 64d BLANK
PICT STO { # 125d
# 0d } { # 125d
# 63d } LINE { # 0d
# 0d } { # 130d
# 63d } BOX 66 125
FOR c 1 c 66 -
66 / \v/ \v/ - 32 * R\->B
c R\->B SWAP DUP2 NEG
63 + 2 \->LIST PIXON
2 \->LIST PIXON 1 126
c - 66 / \v/ \v/ - 32 *
R\->B c 60 - R\->B SWAP
DUP2 NEG 63 + 2
\->LIST ROT ROT 2
\->LIST LINE
NEXT { # 0d
# 0d } PVIEW 0 WAIT
DROP { # 65d # 31d
} { # 125d # 32d }
BOX 7 64
FOR c 1 66 c -
66 / \v/ \v/ - 32 * 1 +
R\->B c R\->B SWAP DUP2
NEG 63 + OVER NEG
131 + DUP2 6 PICK 2
\->LIST ROT ROT 2
\->LIST LINE 2 \->LIST
ROT ROT 2 \->LIST
TLINE { # 0d # 0d }
PVIEW t WAIT
NEXT { # 0d
# 0d } PVIEW 0 WAIT
DROP STOF
\>>
\>>
HP 50g
Code:
%%HP: T(3)A(D)F(.);
\<< HMS\-> 60. * 4.5 - 57.1 / \-> t
\<< RCLF -40. CF # 131d # 80d BLANK PICT STO { # 125d # 6d } { # 125d # 73d } LINE { # 0d # 6d } { # 130d # 73d } BOX 66. 125.
FOR c 1. c 66. - 66. / \v/ \v/ - 34. * 6. + R\->B c R\->B SWAP DUP2 NEG 79. + 2. \->LIST PIXON 2. \->LIST PIXON 1. 126. c - 66. / \v/ \v/ - 34. * 6. + R\->B c 60. - R\->B SWAP DUP2 NEG 79. + 2. \->LIST UNROT 2. \->LIST LINE
NEXT { # 0d # 0d } PVIEW 0. WAIT DROP { # 65d # 39d } { # 125d # 40d } BOX 7. 64.
FOR c 1. 66. c - 66. / \v/ \v/ - 34. * 7. + R\->B c R\->B SWAP DUP2 NEG 79. + OVER NEG 131. + DUP2 6. PICK 2. \->LIST UNROT 2. \->LIST LINE 2. \->LIST UNROT 2. \->LIST TLINE { # 0d # 0d } PVIEW t WAIT
NEXT { # 0d # 0d } PVIEW 0. WAIT DROP STOF
\>>
\>>
Usage:
- Enter time in mm.ss format; time >= 0.15 (15 s) on the HP-48GX and >= 0.045 (4.5 s) on the HP 50g
- run program
- any key to start
- any key to exit
Not a surprise anymore:
-----------
Update:
Though the difference ( for y = x^4 ) in relation to the previous version is barely noticeable, here are versions with x and y axes in the same scale. The constant 11.5 is an approximation to 32/60^(1/4).
HP-48GX
Checksum #46537d
Size 694
Code:
%%HP: T(3)A(D)F(.);
\<< HMS\-> 60 * 13.1 -
58 / RCLF -40 CF
# 131d # 64d BLANK
PICT STO { # 125d
# 0d } { # 125d
# 63d } LINE { # 0d
# 0d } { # 130d
# 63d } BOX 66 125
FOR x x R\->B 32 x
66 - \v/ \v/ 11.5 * -
R\->B DUP2 DUP2 NEG
63 + 2 \->LIST PIXON
2 \->LIST PIXON SWAP
NEG 131 + SWAP DUP2
NEG 63 + 2 \->LIST
ROT ROT 2 \->LIST
LINE
NEXT { # 0d # 0d
} PVIEW 0 WAIT DROP
{ # 65d # 31d } {
# 125d # 32d } BOX
7 64
FOR x OVER WAIT
33 65 x - \v/ \v/ 11.5
* - R\->B x R\->B SWAP
DUP2 NEG 63 + OVER
NEG 131 + DUP2 6
PICK 2 \->LIST ROT
ROT 2 \->LIST LINE 2
\->LIST ROT ROT 2
\->LIST TLINE
NEXT 0 WAIT ROT
DROP2 STOF
\>>
HP 50g
Checksum #45216d
Size 686.5
Code:
%%HP: T(3)A(D)F(.);
\<< HMS\-> 60. * 3.8 - 58. / RCLF -40. CF # 131d # 80d BLANK PICT STO { # 125d # 8d } { # 125d # 71d } LINE { # 0d # 8d } { # 130d # 71d } BOX 66. 125.
FOR x x R\->B 40. x 66. - \v/ \v/ 11.5 * - R\->B DUP2 DUP2 NEG 79. + 2. \->LIST PIXON 2. \->LIST PIXON SWAP NEG 131. + SWAP DUP2 NEG 79. + 2. \->LIST UNROT 2. \->LIST LINE
NEXT { # 0d # 0d } PVIEW 0. WAIT DROP { # 65d # 39d } { # 125d # 40d } BOX 7. 64.
FOR x OVER WAIT 41. 65. x - \v/ \v/ 11.5 * - R\->B x R\->B SWAP DUP2 NEG 79. + OVER NEG 131. + DUP2 6. PICK 2. \->LIST UNROT 2. \->LIST LINE 2. \->LIST UNROT 2. \->LIST TLINE
NEXT 0. WAIT DROP NIP STOF
\>>
Usage same as above. Minimum timings are are about 14 and 5 seconds, respectively.