Skip to main content

for and with

for​

Parametric graphs with any variable​

Desmos normally uses tt for parametric graphs. With for, any variable can be the parameter.

1
(1,t)(1,t)
2
(2,a) for 0≤a≤1(2,a)\ \mathrm{for}\ 0\leq a\leq1
Loading graph…
Open in Desmos ↗

Both bounds must be explicit, as in 1≤s≤61\leq s\leq6. Use infinity for an unbounded side: 1≤s<∞1\leq s<\infty.

Iterating through lists​

1
y=ax for a=[1,2,3]y=ax\ \mathrm{for}\ a=[1,2,3]
2
(x,y) for x=[1,2,3,4],y=[2,3,4](x,y)\ \mathrm{for}\ x=[1,2,3,4],y=[2,3,4]
3
[2i for i=[1,2,4]](=[2,4,8])[2i\ \mathrm{for}\ i=[1,2,4]](=[2,4,8])

With several lists, for uses every combination. See Lists and Sequences.

with​

Substituting a value​

with replaces an existing variable only within one expression.

1
a=5a=5
2
y=axy=ax
3
y=ax with a=10y=ax\ \mathrm{with}\ a=10

The ordinary line is y=5xy=5x; the expression using with draws y=10xy=10x.

Local variables​

1
y=ax with a=5y=ax\ \mathrm{with}\ a=5

This aa cannot be referenced from other expressions, which helps prevent naming collisions. Function parameters can provide a similar structure.

1
f(x,a)=axf(x,a)=ax
2
y=f(x,5)y=f(x,5)