Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Post Made Community Wiki by Dennis
added 1464 characters in body
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66

Length 31 snippet

Menu("","1",A,"2",B
Lbl A
Lbl B

This demonstrates the use of menus. The one above is quite useless, as it does nothing, but they can be used to navigate the different part of a program. The first argument is the menu title, followed by pairs of options (the string displayed followed by a 1- or 2-letter label). Here is a more intuitive example:

Menu("CHOOSE VALUE","AREA",A,"CIRCUMFERENCE",C
Lbl A
Disp πR2
Stop
Lbl C
2πR

Lbl can also be used for branching with Goto. Menus have some limitations that make them annoying to use, however: There can only be seven menu items, and each title can be at most fourteen characters, so the whole thing fits on one screen.

Length 29 snippet

Real
√(-16
a+bi
Ans
re^θi
Ans

Real (on by default) places the calculator in real number mode, so calculations involving complex numbers throw a NONREAL ANS error. When put in a+bi mode, the calculator displays answers as complex numbers if applicable, so the second example returns 4i. re^θi mode uses polar instead of rectangular coordinates, so it outputs 4e^(1.570796327i).

Length 23 snippet

Everyone's favorite, the quadratic formula. Stores the first solution to a quadratic equation as X, assuming a, b, and c are stored in their respective variables, as in ax2 + bx + c.

Here are two examples of a well-known feature of graphing calculators: graphing equations. You can have 10 different equations graphed on the same plane, and there are many useful commands to find intersections, maxima, values of x, etc. Those equations look like this when graphed on a standard window:

Graph

This generates a (pseudo-)random integer between 0 and 8 inclusive. There is an optional third argument that tells how many integers to generate. There are several other random functions:, including ones for normal and binomial distributions, one for a random matrix, and one for a randomly ordered list with no repetitions. randInt can be seeded by storing a number as rand: 2→rand.

.656▶F◀▶D

This prints the least common multipleleast common multiple of 14 and 6, which is 42.

This is Euler's numberthe constant for Euler's number, which displays as 2.718281828. TI-BASIC also has the constant π, but that was used above.

Length 23 snippet

Everyone's favorite, the quadratic formula. Stores the first solution to a quadratic equation as X, assuming a, b, and c are stored in their respective variables.

Here are two examples of a well-known feature of graphing calculators: graphing equations. You can have 10 different equations graphed on the same plane, and there are many useful commands to find intersections, maxima, values of x, etc.

This generates a (pseudo-)random integer between 0 and 8 inclusive. There is an optional third argument that tells how many integers to generate. There are several other random functions: ones for normal and binomial distributions, one for a random matrix, and one for a randomly ordered list with no repetitions. randInt can be seeded by storing a number as rand: 2→rand.

656▶F◀▶D

This prints the least common multiple of 14 and 6, which is 42.

This is Euler's number, which displays as 2.718281828. TI-BASIC also has the constant π, but that was used above.

Length 31 snippet

Menu("","1",A,"2",B
Lbl A
Lbl B

This demonstrates the use of menus. The one above is quite useless, as it does nothing, but they can be used to navigate the different part of a program. The first argument is the menu title, followed by pairs of options (the string displayed followed by a 1- or 2-letter label). Here is a more intuitive example:

Menu("CHOOSE VALUE","AREA",A,"CIRCUMFERENCE",C
Lbl A
Disp πR2
Stop
Lbl C
2πR

Lbl can also be used for branching with Goto. Menus have some limitations that make them annoying to use, however: There can only be seven menu items, and each title can be at most fourteen characters, so the whole thing fits on one screen.

Length 29 snippet

Real
√(-16
a+bi
Ans
re^θi
Ans

Real (on by default) places the calculator in real number mode, so calculations involving complex numbers throw a NONREAL ANS error. When put in a+bi mode, the calculator displays answers as complex numbers if applicable, so the second example returns 4i. re^θi mode uses polar instead of rectangular coordinates, so it outputs 4e^(1.570796327i).

Length 23 snippet

Everyone's favorite, the quadratic formula. Stores the first solution to a quadratic equation as X, assuming a, b, and c are stored in their respective variables, as in ax2 + bx + c.

Here are two examples of a well-known feature of graphing calculators: graphing equations. You can have 10 different equations graphed on the same plane, and there are many useful commands to find intersections, maxima, values of x, etc. Those equations look like this when graphed on a standard window:

Graph

This generates a (pseudo-)random integer between 0 and 8 inclusive. There is an optional third argument that tells how many integers to generate. There are several other random functions, including ones for normal and binomial distributions, one for a random matrix, and one for a randomly ordered list with no repetitions. randInt can be seeded by storing a number as rand: 2→rand.

.656▶F◀▶D

This prints the least common multiple of 14 and 6, which is 42.

This is the constant for Euler's number, which displays as 2.718281828.

more snippets
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66

Length 23 snippet

If A≥9
Then
1→X
7→Y
End

This is just a simple conditional, although there can be an Else statement. Then and End are not required if it is just one statement.

Length 21 snippet

(-B+√(B2-4AC))/(2A)→X

Everyone's favorite, the quadratic formula. Stores the first solution to a quadratic equation as X, assuming a, b, and c are stored in their respective variables.

Length 20 snippet

Shade(|X/2|-3,5-X2,0

This shades the intersection of the two functions, with several optional parameters: minimum and maximum values of x and direction of and distance between the shading lines.

Length 18 snippet

Length 18 snippet

Length 23 snippet

If A≥9
Then
1→X
7→Y
End

This is just a simple conditional, although there can be an Else statement. Then and End are not required if it is just one statement.

Length 21 snippet

(-B+√(B2-4AC))/(2A)→X

Everyone's favorite, the quadratic formula. Stores the first solution to a quadratic equation as X, assuming a, b, and c are stored in their respective variables.

Length 20 snippet

Shade(|X/2|-3,5-X2,0

This shades the intersection of the two functions, with several optional parameters: minimum and maximum values of x and direction of and distance between the shading lines.

Length 18 snippet

Snippet 18
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66

Length 18 snippet

LinReg(ax+b) L1,L2

Here we calculate the linear regression equation, or the linear equation that best matches a group of points, with the x-values stored as a list in L1 and the y-values in L2. There are many other regression options available, including quadratic, cubic, and exponential.

Length 17 snippet

Length 17 snippet

Length 18 snippet

LinReg(ax+b) L1,L2

Here we calculate the linear regression equation, or the linear equation that best matches a group of points, with the x-values stored as a list in L1 and the y-values in L2. There are many other regression options available, including quadratic, cubic, and exponential.

Length 17 snippet

3 more snippets
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66
Loading
more snippets
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66
Loading
snippet 9
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66
Loading
snippet 8
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66
Loading
add more snippets
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66
Loading
snippet 4
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66
Loading
2 more snippets
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66
Loading
add length 1 snippet
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66
Loading
Source Link
NinjaBearMonkey
  • 10.4k
  • 3
  • 38
  • 66
Loading

AltStyle によって変換されたページ (->オリジナル) /