curve
A curve on a graph: a function, an equation, or a position in t.
curvexyargandpolarxyzplaneOn this page


#A function of x
curve(f: x^2) plots y as a function of x. On the polar plane the function is of theta and gives r: curve(f: 1 + cos(theta)) is a cardioid. Any other letter in the expression is a parameter, so a * sin(b * x) moves as the reader drags a and b. A function in pieces is one expression built with min, max and clamp: min(2x, 10) rises and then holds at 10, and stays one curve, with one max and min, under any parameter.
#An equation
Written with =, a curve is the set of points where its two sides agree, in both of the plane's coordinates: curve(f: x^2 + y^2 = 4) is a circle, curve(f: x = y^2) a parabola on its side, and curve(f: r = 1 + cos(theta)) the cardioid again. Nothing has to be solved for y first. An equation has no direction, so its ends carry no arrowheads or dots. The ordinary and polar planes take equations; the argand plane and space do not.
#A position in t
A curve may instead be a position in t, with the interval t runs over: curve(x: cos(t); y: sin(t); t: [0, 2pi]). On the argand plane the position is z:, on the polar plane r: and theta:, and in space x:, y: and z:. On the argand plane and in space it is the only form:
graph:argand{
curve(z: cos(t) + i sin(t); t: [0, 2pi])
}A function of x is refused there:
graph:argand{
curve(f: x^2)
}[semantic]'curve: f' needs a dependent axis over an independent one, and the argand plane has none — write a position in t (z: t: [a, b])
A path in t can enclose a region, and fill-style shades it: solid, hatched or dotted, where the default, outlined, leaves it empty. A closed loop fills itself; an arc closes straight across its chord, and close: names a point the region passes through first, so an arc closed through its centre is a sector. A function of x encloses nothing, and refuses any fill-style but outlined; the area under it is an integral. stroke-style draws the curve itself solid, dashed or dotted.
graph{
curve(x: 2 * cos(t); y: 2 * sin(t); t: [0, pi/3]; fill-style: solid; close: (0, 0))
}(
aspect: equal
)#Domains and ends
domain: limits the x a function is drawn over and range: the y; both stop the curve where it crosses them. Where a curve runs off the frame its end is an arrowhead, and where a domain or range stops it the end is a dot, filled at a closed end, [0, 2], and hollow at an open one, (0, 2). !endpoints leaves both off. A curve's max and min are taken over the domain it is drawn on. Given an id, curve#flight, a curve is a path a cue.trace can follow.
#Attributes
t[0, 2pi], ends parametised. Required with the parametric coordinates; not with expression.colourcolour-along-curvecolorbluewidthwidth-along-curve2stroke-stylesolid, dashed or dotted. A function of the point it is at — its x and y, its t on a curve in t, its r and theta on the polar plane — so it may change along the curve: stroke-style: y -> (..<0: dashed; 0..: solid).stroke-along-curvesolidfill-stylesolid, hatched, dotted, or outlined, no shading — one value for the whole region. A y(x) curve shades nothing; the area under a function is integral.solidhatcheddottedoutlinedoutlinedclosepolygon has straight sides and integral closes to the axis. Nothing where fill-style is outlined.close-atdomain[0, 2], hollow for an open one, (0, 2).rangeendpointstruelabel$maths$ and inline formatting render. Fades and draws with the element.hiddenhidden: true !cue.to{false}(at: 2) reveals it — and unlike a cue, a hidden element still frames the plot, so the axes do not jump when it appears.falselockeditable: graph. Nothing at all on a graph that is not editable.lockedfalsetext-size20layergroupgroup: Early sown, Projected. It is drawn in the colour of the first that has one and the style of the first the graph's key: gives one, unless it writes its own colour: or style, and the footer's key names every group.xyplaneexpressioncurve(f: x^2), and r(theta) on the polar one. As an equation, the points where its two sides agree, in the plane's two coordinates: curve(f: 2y = x), curve(f: x^2 + y^2 = 4), curve(f: r = 1 + cos(theta)). The argand plane takes neither — write a position in t there. Not with the parametric coordinates.exp, f, func, functionCan be written as shorthand: curve:valuext, with y: (and z: in space) and t: — curve(x: cos(t); y: sin(t); t: [0, 2pi]). Not with expression.yt, with x: and t:.argandplanezt: curve(z: sqrt(13) * e^(i * t); t: [0, 2pi]). In space, the z coordinate as an expression in t, with x: and y:.polarplaneexpressioncurve(f: x^2), and r(theta) on the polar one. As an equation, the points where its two sides agree, in the plane's two coordinates: curve(f: 2y = x), curve(f: x^2 + y^2 = 4), curve(f: r = 1 + cos(theta)). The argand plane takes neither — write a position in t there. Not with the parametric coordinates.exp, f, func, functionCan be written as shorthand: curve:valuert, with theta: and t:.thetat, with r: and t:.xyzplanext, with y: (and z: in space) and t: — curve(x: cos(t); y: sin(t); t: [0, 2pi]). Not with expression.yt, with x: and t:.zt: curve(z: sqrt(13) * e^(i * t); t: [0, 2pi]). In space, the z coordinate as an expression in t, with x: and y:.#Derived attributes
Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.
lengthmax, a curve in t over its whole t: (in space too), a polar r(θ) over the theta window; holes add nothing. A dash for an equation, or where an axis is a log scale, names or dates.xyplanemaxrange:, tracking parameters live; a dash for a curve in t, an equation, or a domain with no value in it.minmax is.max-xmax; a dash where max is.min-xmin; a dash where min is.#Allowed in
#Examples


graph{
curve(expression: x^2; colour: blue)
}

graph{
curve(expression: sin(x); domain: [-pi, pi])
}

graph:xyz{
curve(x: 2 * cos(t); y: 2 * sin(t); z: t / 2; t: [0, 4pi]; colour: red)
}(
x domain: [-3, 3]
y domain: [-3, 3]
z domain: [0, 7]
)

graph{
curve(f: 2y = x; colour: blue)
curve(f: x^2 + y^2 = 4; colour: purple)
curve(f: x = y^2 - 2; colour: orange)
}(
x domain: [-4.5, 4.5]
y domain: [-3, 3]
aspect: equal
)#Notes
- Give a curve a node id —
curve#flight(f: …)— to letcue.tracefollow it withpath: #flight.