Learn more about: Enabling Actions  |  Getting Started with Actions
Clickable Objects  |  The Ticker  |  Actions Using Variables and Function Notation



Actions provide a way to react to events in the calculator, like clicks or clock ticks. An action is composed of one or more update rules that each specify a new value for a variable, depending on a specific event within the expression list or the graph paper.

Use the resources below to enable Actions on your account and learn about all of the features that are available once they're enabled.


Enabling Actions

Actions are an advanced feature in our graphing calculator that you must enable at the account level.

Desmos graphing calculator with Log In and Sign Up Buttons called out. Screenshot.

Make sure you sign in to your account on the Desmos Graphing Calculator.

Desmos graphing calculator with name clicked and drop down menu showing.  Option to select Account Settings or to Sign Out. Screenshot.

Click on your name in the top right to bring up account options and click Account Settings.

Account settings page on graphing calculator. Advanced tab is selected, and actions are checked. Dialog box notes that preferences are saved. Screenshot.

Go to the Advanced tab and check the Actions checkbox.


Getting Started With Actions

Expression window.  Typing letter a followed by subtraction sign, followed by greater than symbol.  Final two symbols merge into a right-pointing arrow. Animated.

Use a right arrow to author an action. You can write the → symbol by typing the subtraction symbol (-) followed by a greater than sign (>).

Action to increment a to \(a+1\) is included.  Action button is pressed numerous times, taking the value of a from zero to eight. Animated.

When you write an action in the expression list, make sure you enable the slider for the included variable.

The expression with the action will then display an action icon that will run the action every time you click on it.

Three different actions in the expression window. \(a\) → 1. \(a\) → \(a\) + 1. \(a\) → \(b\), \(b\) → \(a\). Sliders for a and b.  Currently sliders are set at six for a and one for b. Screenshot.

Some examples of basic actions:

Set \(a\) to 1: \(a\) → 1

Increment \(a\): \(a\) → \(a\) + 1

Swap the values of \(a\) and \(b\): \(a\) → \(b\), \(b\) → \(a\)


Clickable Objects

When actions are enabled, you can attach an action to graphed objects like points, curves, and images. The action will run when the object is clicked in the graphing calculator window.

Style Menu for a point opened in expression window.  Options now include Clickable because an action is included elsewhere in the expression window.  Screenshot.

Long press the expression icon to bring up the style menu.

Clickable is selected in the style menu for a point.  A field has appeared titled On Click. Screenshot.

Toggle Clickable to the “on” position.

Clickable has been selected in the style menu for a point.  In the On Click field, the action \(a\) → \(a\) + 1 has been entered. Screenshot.

In the field titled On Click, you can author an action that will be performed when the object is clicked within the graphing calculator itself.

Clickable Objects: Example One

In the example to the right, the compound inequality \(0\) ≤ \(y\) ≤ \(k-x^{2}\) has been made clickable, with the action incrementing the variable \(k\) by one with each click anywhere in the inequality.

Explore this graph at this link.

Inequality graphed within the bounds of a parabola and the x-axis. As the parabola is clicked, in increases in size. Animated.

Clickable Objects: Example Two

In this example, functions are defined to produce actions, and polygons are used to increment or decrement the value of a variable, which represents the slope of a graphed line.

Explore this unique implementation of actions and clickable objects at this link.

Two triangles aligned vertically with the equation \(y=1x\) between them. The upper triangle is clicked four times, incrementing the coefficient of the equation in the center up to five.  The bottom triangle is then clicked seven times, decrementing the value down to negative two.  A line is graphed for each new equation showing how the slope changes. Animated.



The Ticker

When actions are enabled, you can specify an action that will run repeatedly at a specified interval.

Add expression menu in the graphing calculator. Options include expression, note, table, folder image, and ticker.  Screenshot.

To add a ticker, click the Add Expression button in the top left of the expression panel of the graphing calculator. You can also type ticker into an expression line.

Action has been entered in ticker field. \(a\) → \(b\), \(b\) → \(a\).  Time has been set to 100 ms. Sliders added for a and b, currently set a to two and b to zero. Screenshot.

Specify an action to run.

Optionally, specify how much time (in ms) should pass between ticks.

Action has been entered in ticker field. \(a\) → \(b\), \(b\) → \(a\).  Time has been set to 1000 ms. Sliders added for a and b. Ticker is running and a and b are alternating values between zero and two. Animated.

Click the icon next to the ticker to run the action repeatedly over the time interval.


Actions using Variables and Function Notation

Action \(A = a\) → 1 is in the first expression line.  The second line has a slider for A. The style menu is open for a parabola (graphed, equation hidden by style menu).  The parabola has been made clickable, and \(A\) is entered into the On Click field.  Screenshot.

Actions can be assigned to variables:

\(A = a\) → 1

This allows attaching the same action to several objects.

First expression line contains function/action \(f(x) = a\) → \(x\).  Second expression line has slider for a with value set to two. Third expression lines contain actions \(f(1)\) and \(f(2)\).  Screenshot.

Functions can also produce actions:

\(f(x) = a\) → \(x\)

This allows making related actions, so with this definition, \(f(1)\) and \(f(2)\) will be two different actions that set \(a\) to different values when they run.

First expression line contains piecewise function: {\(a\gt0: \(a\)→ \(a -1\)}. Second expression line is a slider for a currently set to one.  Third expression line contains piecewise function {\(a\lte0: \(b\)→ 1, \(c\)→ 1 )}. Fourth expression line has a slider for b set to one.  Fifth expression line has a slider for c set to one. Screenshot.

Piecewise expressions (using restriction notation in curly braces) allow selecting between different actions depending on a condition.

You can do things like decrement \(a\), but only if it is positive. Or, if \(a\) is not positive, set \(b\) to 1, otherwise, set \(c\) to 1.

Pro Tips

Image of an ant standing on point at ordered pair (-2,0).  Other points are plotted at (0,0), (2,0), (5,0).  Screenshot.

When a click action is attached to a list, the special variable “index” represents which element of the list was clicked.

Click here to see an example of using Lists with actions.

Circle with 60 dots around the outside, giving the impression of a clock or stop watch.  Single green hand is pointed directly up.  Screenshot.

In tick actions, the special variable \(dt\) represents how much time has passed since the last tick. You can use \(dt\) to track how long the ticker has been playing.

Click here to see an example graph that uses \(dt\) to measure the ticker time.

Coordinate plane between zero and one on both the x-axis and y-axis.  Point is moving along the y=x line at randomly spaced intervals.  Animated

When random( ) is used in an action definition, a new random number will be used every time the action runs.

Click here to see random numbers used in an action.