Skip to main content
Reduced byte count for answer and fixed a few typos
Source Link
absoluteAquarian
  • 2.8k
  • 1
  • 12
  • 23

TI-BASIC (TI-83), 111103 111 118 bytes

-7 bytes from Ans manipulation and better variable modifications
-8 bytes from removing usage of the A and B variables

21.35→A 88→Xmax ; Set the graph bounds to something Ans→Xmax ⁻Ans→Xmin ; reasonable so that it looks nice ⁻Ans→Xmin 1.55→B Ans→Ymax24→Ymax ⁻Ans→Ymin AxesOff For(X,⁻AXmin,AXmax,.05 ΔX ; Loop over each pixel on the graph For(Y,⁻BYmin,BYmax,.05ΔY DelVar NX+Yi→C ; Reset N to 0 and set the constant While N<20 and 2≥abs(Ans ; Loop for at most 20 iterations or until ; the number's magnitude is > 2 IS>(N,0: ; Increment N without updating Ans Ans²+C ; Put the next number in Ans End If N≥20 ; Draw a dot if the coordinate did not Pt-On(X,Y ; result in a diverging series End End 

Graph resultGraph result

X-bounds of [-2,2] and Y-bounds of [-1.32,1.32] would result in a closer graph, but the step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of a clean \$\frac{1}{20}\$ (.05), so I opted for the bounds used instead.
The original answer used X-bounds of [-2.35,2]2.35] and Y-bounds of [-1.3255,1.32]55] would result inso that each pixel was a closer graphstep of \$\frac{1}{20}\$, but the new answer has each pixel as a step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of\$\frac{1}{25}\$.
This results in a clean \$\frac{1}{20}\$ (.05), so I opted forcloser and more detailed graph of the bounds used insteadset.

TI-BASIC (TI-83), 111 118 bytes

-7 bytes from Ans manipulation and better variable modifications

2.35→A  ; Set the graph bounds to something Ans→Xmax  ; reasonable so that it looks nice ⁻Ans→Xmin 1.55→B Ans→Ymax ⁻Ans→Ymin AxesOff For(X,⁻A,A,.05  ; Loop over each pixel on the graph For(Y,⁻B,B,.05 DelVar NX+Yi→C ; Reset N to 0 and set the constant While N<20 and 2≥abs(Ans ; Loop for at most 20 iterations or until ; the number's magnitude is > 2 IS>(N,0: ; Increment N without updating Ans Ans²+C ; Put the next number in Ans End If N≥20 ; Draw a dot if the coordinate did not Pt-On(X,Y ; result in a diverging series End End 

Graph result

X-bounds of [-2,2] and Y-bounds of [-1.32,1.32] would result in a closer graph, but the step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of a clean \$\frac{1}{20}\$ (.05), so I opted for the bounds used instead.

TI-BASIC (TI-83), 103 111 118 bytes

-7 bytes from Ans manipulation and better variable modifications
-8 bytes from removing usage of the A and B variables

1.88→Xmax ; Set the graph bounds to something ⁻Ans→Xmin ; reasonable so that it looks nice 1.24→Ymax ⁻Ans→Ymin AxesOff For(X,Xmin,Xmax,ΔX ; Loop over each pixel on the graph For(Y,Ymin,Ymax,ΔY DelVar NX+Yi→C ; Reset N to 0 and set the constant While N<20 and 2≥abs(Ans ; Loop for at most 20 iterations or until ; the number's magnitude is > 2 IS>(N,0: ; Increment N without updating Ans Ans²+C ; Put the next number in Ans End If N≥20 ; Draw a dot if the coordinate did not Pt-On(X,Y ; result in a diverging series End End 

Graph result

X-bounds of [-2,2] and Y-bounds of [-1.32,1.32] would result in a closer graph, but the step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of a clean \$\frac{1}{20}\$ (.05), so I opted for the bounds used instead.
The original answer used X-bounds of [-2.35,2.35] and Y-bounds of [-1.55,1.55] so that each pixel was a step of \$\frac{1}{20}\$, but the new answer has each pixel as a step of \$\frac{1}{25}\$.
This results in a closer and more detailed graph of the set.

Used better unicode character for negation token, fixed N check which should've been "greater than or equal" rather than "greater than"
Source Link
absoluteAquarian
  • 2.8k
  • 1
  • 12
  • 23

TI-BASIC (TI-83), 111 118 bytes

-7 bytes from Ans manipulation and better variable modifications

2.35→A ; Set the graph bounds to something Ans→Xmax ; reasonable so that it looks nice ‾Ans→Xmin⁻Ans→Xmin 1.55→B Ans→Ymax ‾Ans→Ymin⁻Ans→Ymin AxesOff For(X,‾A⁻A,A,.05 ; Loop over each pixel on the graph For(Y,‾B⁻B,B,.05 DelVar NX+Yi→C ; Reset N to 0 and set the constant While N<20 and 2≥abs(Ans ; Loop for at most 20 iterations or until ; the number's magnitude is > 2 IS>(N,0: ; Increment N without updating Ans Ans²+C ; Put the next number in Ans End If N>20N≥20 ; Draw a dot if the coordinate did not Pt-On(X,Y ; result in a diverging series End End 

Graph result

A simple nested loop with the standard \$z_{n+1}=z_n^2+c\$ function for the iterations.

The coordinates \$(X,Y)\$ are converted to a complex number \$X+Yi\$ to allow for complex arithmetic.

X-bounds of [-2,2] and Y-bounds of [-1.32,1.32] would result in a closer graph, but the step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of a clean \$\frac{1}{20}\$ (.05), so I opted for the bounds used instead.

TI-BASIC Quirks:
DelVar N ends at the variable token, so a newline isn't needed.
The effective code is:

DelVar N X+Yi→C 

IS>(N,0: uses the same amount of tokens as N+1→N, but it doesn't update Ans.
This allows incrementing N while still preserving Ans as the current sequence number.


Note: TI-BASIC is a tokenized language. Character count does not equal byte count.

Program size is equal to \$MEM\: byte\: count - program\: name\: length - 9\: bytes\$.

While the image shows me using a TI-84+ calculator, all of the tokens used are present in the TI-83 set of tokens, so this program can be used there as well.

TI-BASIC (TI-83), 111 118 bytes

-7 bytes from Ans manipulation and better variable modifications

2.35→A ; Set the graph bounds to something Ans→Xmax ; reasonable so that it looks nice ‾Ans→Xmin 1.55→B Ans→Ymax ‾Ans→Ymin AxesOff For(X,‾A,A,.05 ; Loop over each pixel on the graph For(Y,‾B,B,.05 DelVar NX+Yi→C ; Reset N to 0 and set the constant While N<20 and 2≥abs(Ans ; Loop for at most 20 iterations or until ; the number's magnitude is > 2 IS>(N,0: ; Increment N without updating Ans Ans²+C ; Put the next number in Ans End If N>20 ; Draw a dot if the coordinate did not Pt-On(X,Y ; result in a diverging series End End 

Graph result

A simple nested loop with the standard \$z_{n+1}=z_n^2+c\$ function for the iterations.

The coordinates \$(X,Y)\$ are converted to a complex number \$X+Yi\$ to allow for complex arithmetic.

X-bounds of [-2,2] and Y-bounds of [-1.32,1.32] would result in a closer graph, but the step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of a clean \$\frac{1}{20}\$ (.05), so I opted for the bounds used instead.

TI-BASIC Quirks:
DelVar N ends at the variable token, so a newline isn't needed.
The effective code is:

DelVar N X+Yi→C 

IS>(N,0: uses the same amount of tokens as N+1→N, but it doesn't update Ans.
This allows incrementing N while still preserving Ans as the current sequence number.


Note: TI-BASIC is a tokenized language. Character count does not equal byte count.

Program size is equal to \$MEM\: byte\: count - program\: name\: length - 9\: bytes\$.

While the image shows me using a TI-84+ calculator, all of the tokens used are present in the TI-83 set of tokens, so this program can be used there as well.

TI-BASIC (TI-83), 111 118 bytes

-7 bytes from Ans manipulation and better variable modifications

2.35→A ; Set the graph bounds to something Ans→Xmax ; reasonable so that it looks nice ⁻Ans→Xmin 1.55→B Ans→Ymax ⁻Ans→Ymin AxesOff For(X,⁻A,A,.05 ; Loop over each pixel on the graph For(Y,⁻B,B,.05 DelVar NX+Yi→C ; Reset N to 0 and set the constant While N<20 and 2≥abs(Ans ; Loop for at most 20 iterations or until ; the number's magnitude is > 2 IS>(N,0: ; Increment N without updating Ans Ans²+C ; Put the next number in Ans End If N≥20 ; Draw a dot if the coordinate did not Pt-On(X,Y ; result in a diverging series End End 

Graph result

A simple nested loop with the standard \$z_{n+1}=z_n^2+c\$ function for the iterations.

The coordinates \$(X,Y)\$ are converted to a complex number \$X+Yi\$ to allow for complex arithmetic.

X-bounds of [-2,2] and Y-bounds of [-1.32,1.32] would result in a closer graph, but the step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of a clean \$\frac{1}{20}\$ (.05), so I opted for the bounds used instead.

TI-BASIC Quirks:
DelVar N ends at the variable token, so a newline isn't needed.
The effective code is:

DelVar N X+Yi→C 

IS>(N,0: uses the same amount of tokens as N+1→N, but it doesn't update Ans.
This allows incrementing N while still preserving Ans as the current sequence number.


Note: TI-BASIC is a tokenized language. Character count does not equal byte count.

Program size is equal to \$MEM\: byte\: count - program\: name\: length - 9\: bytes\$.

While the image shows me using a TI-84+ calculator, all of the tokens used are present in the TI-83 set of tokens, so this program can be used there as well.

Clarification of minus operator rather than subtraction
Source Link
absoluteAquarian
  • 2.8k
  • 1
  • 12
  • 23

TI-BASIC (TI-83), 111 118 bytes

-7 bytes from Ans manipulation and better variable modifications

2.35→A ; Set the graph bounds to something Ans→Xmax ; reasonable so that it looks nice -Ans→Xmin‾Ans→Xmin 1.55→B Ans→Ymax -Ans→Ymin‾Ans→Ymin AxesOff For(X,-A‾A,A,.05 ; Loop over each pixel on the graph For(Y,-B‾B,B,.05 DelVar NX+Yi→C ; Reset N to 0 and set the constant While N<20 and 2≥abs(Ans ; Loop for at most 20 iterations or until ; the number's magnitude is > 2 IS>(N,0: ; Increment N without updating Ans Ans²+C ; Put the next number in Ans End If N>20 ; Draw a dot if the coordinate did not Pt-On(X,Y ; result in a diverging series End End 

Graph result

A simple nested loop with the standard \$z_{n+1}=z_n^2+c\$ function for the iterations.

The coordinates \$(X,Y)\$ are converted to a complex number \$X+Yi\$ to allow for complex arithmetic.

X-bounds of [-2,2] and Y-bounds of [-1.32,1.32] would result in a closer graph, but the step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of a clean \$\frac{1}{20}\$ (.05), so I opted for the bounds used instead.

TI-BASIC Quirks:
DelVar N ends at the variable token, so a newline isn't needed.
The effective code is:

DelVar N X+Yi→C 

IS>(N,0: uses the same amount of tokens as N+1→N, but it doesn't update Ans.
This allows incrementing N while still preserving Ans as the current sequence number.


Note: TI-BASIC is a tokenized language. Character count does not equal byte count.

Program size is equal to \$MEM\: byte\: count - program\: name\: length - 9\: bytes\$.

While the image shows me using a TI-84+ calculator, all of the tokens used are present in the TI-83 set of tokens, so this program can be used there as well.

TI-BASIC (TI-83), 111 118 bytes

-7 bytes from Ans manipulation and better variable modifications

2.35→A ; Set the graph bounds to something Ans→Xmax ; reasonable so that it looks nice -Ans→Xmin 1.55→B Ans→Ymax -Ans→Ymin AxesOff For(X,-A,A,.05 ; Loop over each pixel on the graph For(Y,-B,B,.05 DelVar NX+Yi→C ; Reset N to 0 and set the constant While N<20 and 2≥abs(Ans ; Loop for at most 20 iterations or until ; the number's magnitude is > 2 IS>(N,0: ; Increment N without updating Ans Ans²+C ; Put the next number in Ans End If N>20 ; Draw a dot if the coordinate did not Pt-On(X,Y ; result in a diverging series End End 

Graph result

A simple nested loop with the standard \$z_{n+1}=z_n^2+c\$ function for the iterations.

The coordinates \$(X,Y)\$ are converted to a complex number \$X+Yi\$ to allow for complex arithmetic.

X-bounds of [-2,2] and Y-bounds of [-1.32,1.32] would result in a closer graph, but the step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of a clean \$\frac{1}{20}\$ (.05), so I opted for the bounds used instead.

TI-BASIC Quirks:
DelVar N ends at the variable token, so a newline isn't needed.
The effective code is:

DelVar N X+Yi→C 

IS>(N,0: uses the same amount of tokens as N+1→N, but it doesn't update Ans.
This allows incrementing N while still preserving Ans as the current sequence number.


Note: TI-BASIC is a tokenized language. Character count does not equal byte count.

Program size is equal to \$MEM\: byte\: count - program\: name\: length - 9\: bytes\$.

While the image shows me using a TI-84+ calculator, all of the tokens used are present in the TI-83 set of tokens, so this program can be used there as well.

TI-BASIC (TI-83), 111 118 bytes

-7 bytes from Ans manipulation and better variable modifications

2.35→A ; Set the graph bounds to something Ans→Xmax ; reasonable so that it looks nice ‾Ans→Xmin 1.55→B Ans→Ymax ‾Ans→Ymin AxesOff For(X,‾A,A,.05 ; Loop over each pixel on the graph For(Y,‾B,B,.05 DelVar NX+Yi→C ; Reset N to 0 and set the constant While N<20 and 2≥abs(Ans ; Loop for at most 20 iterations or until ; the number's magnitude is > 2 IS>(N,0: ; Increment N without updating Ans Ans²+C ; Put the next number in Ans End If N>20 ; Draw a dot if the coordinate did not Pt-On(X,Y ; result in a diverging series End End 

Graph result

A simple nested loop with the standard \$z_{n+1}=z_n^2+c\$ function for the iterations.

The coordinates \$(X,Y)\$ are converted to a complex number \$X+Yi\$ to allow for complex arithmetic.

X-bounds of [-2,2] and Y-bounds of [-1.32,1.32] would result in a closer graph, but the step for Y would end up being an ugly and longer fraction of \$\frac{33}{775}\$ (.04258) instead of a clean \$\frac{1}{20}\$ (.05), so I opted for the bounds used instead.

TI-BASIC Quirks:
DelVar N ends at the variable token, so a newline isn't needed.
The effective code is:

DelVar N X+Yi→C 

IS>(N,0: uses the same amount of tokens as N+1→N, but it doesn't update Ans.
This allows incrementing N while still preserving Ans as the current sequence number.


Note: TI-BASIC is a tokenized language. Character count does not equal byte count.

Program size is equal to \$MEM\: byte\: count - program\: name\: length - 9\: bytes\$.

While the image shows me using a TI-84+ calculator, all of the tokens used are present in the TI-83 set of tokens, so this program can be used there as well.

Reduced byte count for answer by using Ans more and changing how N is updated
Source Link
absoluteAquarian
  • 2.8k
  • 1
  • 12
  • 23
Loading
Source Link
absoluteAquarian
  • 2.8k
  • 1
  • 12
  • 23
Loading