The Desmos Graphing Calculator allows you to specify domains, ranges, and simple conditional branching using curly braces {}.
To define ranges or conditions for domains, ranges, or other expressions, you can use curly braces {} at the end of the expression.
You can also apply conditions to implicit functions.
To define multiple conditions, you can either separate them with commas inside a single set of curly braces {} or use multiple curly braces in parallel.
Consider the difference between the two expressions below:
When conditions are separated by commas inside a single set of curly braces, the graph is drawn if any of the conditions are satisfied. However, when conditions are written in parallel using multiple curly braces, the graph is drawn only if all conditions are satisfied.
You can define expressions for specific conditions using the format: { condition1:expression1, condition2:expression2, … }.
Complex conditions like "and" or "or" are not directly supported. Instead, you can rephrase them mathematically. For example:
Alternatively, you can create complex conditional branching by nesting {}.
{}The two types of {} introduced earlier actually follow the same underlying rules.
Specifically, when using { condition1:expression1, condition2:expression2, … }, the behavior is as follows:
{}{} is not drawn or executed.For example, the usage introduced earlier for setting ranges and conditions is a special case where the expression corresponding to the condition is omitted. When an expression is omitted, it defaults to 1. Consider the following example:
In this expression, when , the condition is not satisfied, so the expression is not drawn. However, when , the condition evaluates to 1, resulting in:
As a result, this expression is drawn.
Now, consider another example:
Here, the graph is drawn only when both and are satisfied. This is because each condition evaluates to 1 when true, so the expression becomes:
Thus, the graph is displayed only in the region where both conditions are met.