field

A differential equation drawn as the directions it gives, with the solutions that follow them.

fieldNode
Only withxyargandxyzplane
On this page
The predator–prey arrows of the Lotka–Volterra equations, coloured by strength, circling the balance point at (2, 2).The predator–prey arrows of the Lotka–Volterra equations, coloured by strength, circling the balance point at (2, 2).

A field draws a differential equation: at each point of a grid, a mark in the direction the equation gives there. Every mark is the same length, so direction is what is read, and the field's strength is its colour, a ramp or a hue as a surface's is, with the footer's key reading the strength under the cursor. The colours span the middle nine tenths of the strengths in the window, or the window colour: #self.value -> 0..4 -> multicolour pins. density is how many marks run across the wider side of the plot, 20 unless written.

#Slopes and systems

field(slope: x - y) is the first-order equation y′ = x − y, drawn as a slope field of short ticks with no heads, since a slope has a steepness and no forward. field(dx: y; dy: -x) is the system x′ = y, y′ = −x, drawn as arrows: the phase plane, where each point is a state and the arrow says where it goes next. One form or the other; a field given both is refused: 'field' is a slope or a system, not both — drop 'expression' for x′ = dx, y′ = dy, or drop 'dx'/'dy' for y′ = f(x, y).

On the argand plane a field is one function of z, field(f: z^2 - 1): the flow of z′ = f(z). In space it is the system dx, dy, dz, drawn as arrows on a grid through the box. The number line and the polar plane take no field. In a field's expressions the plane's coordinates are axes, and every other letter is a parameter: dy: r * y * (1 - y) is logistic growth with a slider for r.

#Solutions

from: (1, 0), (2.5, 0) starts a solution at each point. Each runs both ways in time until it leaves the window, comes to rest or closes a loop, and is worked out again whenever a parameter moves; span: [0, 5] runs it over that stretch of time instead, forward only. The reader can drag a starting point and its solution follows; !draggable fixes them. !arrows leaves only the solutions, and solution colour and solution width style them.

The FitzHugh–Nagumo neuron as a direction field over voltage and recovery, with one orange solution settling onto the closed loop of a neuron firing repeatedly.The FitzHugh–Nagumo neuron as a direction field over voltage and recovery, with one orange solution settling onto the closed loop of a neuron firing repeatedly.
graph{
    field(
        dx: x - x^3 / 3 - y + 0.5
        dy: 0.08 * (x + 0.7 - 0.8 * y)
        from: (-1.2, -0.6)
    )
}(
    x-domain: [-2.5, 2.5]
    y-domain: [-1, 2]
    x-axis-label: $v$
    y-axis-label: $w$
)

#Drawing, tracing and flow

Inside a cue.draw, each solution is drawn in from its earliest time to its latest while the arrows fade in. A cue.trace with path: #phase rides the field's first solution, so a dot and the line it draws arrive together. flow sets dots moving through the field at its own speeds, slow where it is weak and fast where it is strong; they stay still for a reader who has asked for reduced motion.


#Attributes

On any plane
expressionImplicitAnimatable
The slope y′=f(x,y)y' = f(x, y) on the xy plane, or f(z)f(z) on the argand plane. Written instead of dx and dy, never beside them.
field-expression
Also written: slope, f, exp, func, functionCan be written as shorthand: field:value
dzAnimatable
In space, z′ — the third component of the system x′ = dx, y′ = dy, z′ = dz, which is the only form a field takes there. Space only.
field-component
fromAnimatable
Where solutions start, each a pair in the plane's axes: from: (1, 0), (2.5, 0). A cue.trace naming the field rides the first one.
Also written: seeds, through
spanAnimatable
The time each solution runs over, its seed at 0: [0, 5] runs forward only. Absent, a solution runs both ways until it leaves the window, comes to rest or closes a loop.
Also written: t, time
densityAnimatable
How many arrows across the wider side of the plot; the grid is square.
Default20
arrowsAnimatable
Draw the grid of arrows. Off, only the solutions and the flow are drawn.
Defaulttrue
flowAnimatable
Dots carried along the field at its own speeds, continuously. Still for a reader who has asked for reduced motion.
Defaultfalse
draggable
Whether the reader may drag a seed; its solution is re-integrated as it moves.
Also written: drag
Defaulttrue
colour
The arrows' paint by the field's strength: multicolour (the default) runs violet weak to red strong, temperature the blue → white → red ramp, a hue its own pale to deep. The ramp runs from the 5th to the 95th percentile of the strengths across the window; applying #self.value, the strength, pins it instead, stronger and weaker arrows taking the ramp's ends: colour: #self.value -> 0..4 -> multicolour. The footer's key prices the cursor at the strength under it.
value-colour-style
Also written: color
Defaultmulticolour
widthAnimatable
The arrows' stroke width.
Default1.25
opacityAnimatable
How heavy the arrows sit over the marks beneath them.
Default0.85
solution-colourAnimatable
The colour of the solutions, their seeds and the flowing dots.
paint
Also written: solution-color
Defaultorange
solution-widthAnimatable
The solutions' stroke width.
Default2
hiddenAnimatable
Declared but not drawn — animatable, so hidden: true !cue.to{false}(at: 2) is its reveal.
Defaultfalse
lock
A reader may not edit it on an editable graph.
Also written: locked
Defaultfalse
layerAnimatable
Paint order among the marks: a higher layer is drawn later, on top; equal or omitted, the marks stack in document order (later on top).
group
The groups this mark belongs to, comma-separated: group: 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.
Only withxyplane
dxAnimatable
x′x' in a system of two, in x and y. Needs dy.
field-component
dyAnimatable
y′y' in a system of two, in x and y. Needs dx.
field-component

#Derived attributes

Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.

valueDerived
The field's strength at each arrow, which colour: follows as #self.value: colour: #self.value -> 0..5 -> temperature pins the strengths the ramp spans.

#Allowed in

#Examples

In space: the field x′ = −y, y′ = x, z′ = 0.3, turning about the z axis as it rises, with the helix through (1.5, 0, −2).In space: the field x′ = −y, y′ = x, z′ = 0.3, turning about the z axis as it rises, with the helix through (1.5, 0, −2).
graph:xyz{
    field(dx: -y; dy: x; dz: 0.3; from: (1.5, 0, -2))
}(
    x domain: [-2, 2]
    y domain: [-2, 2]
    z domain: [-2, 2]
)
The slope field of y′ = x − y as short headless ticks coloured by steepness, levelling out along the line y = x − 1.The slope field of y′ = x − y as short headless ticks coloured by steepness, levelling out along the line y = x − 1.
graph{
    field(slope: x - y)
}(
    x-domain: [-4, 4]
    y-domain: [-4, 4]
)
The phase plane of a damped pendulum in blue arrows, with two orange solutions spiralling into the rest point at the origin between the saddles at ±π.The phase plane of a damped pendulum in blue arrows, with two orange solutions spiralling into the rest point at the origin between the saddles at ±π.
graph{
    field(
        dx: y
        dy: -sin(x) - 0.3 * y
        from: (-2, 1), (2.5, -0.5)
        colour: blue
    )
}(
    x-domain: [-7, 7]
    y-domain: [-3, 3]
    x-axis-label: $\theta$
    y-axis-label: $\theta'$
)
The flow of z′ = z² − 1 on the argand plane, its arrows on the blue-to-red temperature ramp, streaming out of +1 and into −1.The flow of z′ = z² − 1 on the argand plane, its arrows on the blue-to-red temperature ramp, streaming out of +1 and into −1.
graph:argand{
    field(f: z^2 - 1; colour: temperature)
}(
    re-domain: [-2, 2]
    im-domain: [-2, 2]
)

Last updated