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


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.


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
expressiondx and dy, never beside them.field-expressionslope, f, exp, func, functionCan be written as shorthand: field:valuedzfield-componentfromfrom: (1, 0), (2.5, 0). A cue.trace naming the field rides the first one.seeds, throughspan[0, 5] runs forward only. Absent, a solution runs both ways until it leaves the window, comes to rest or closes a loop.t, timedensity20arrowstrueflowfalsedraggabledragtruecolour#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-stylecolormulticolourwidth1.25opacity0.85solution-colourpaintsolution-colororangesolution-width2hiddenhidden: true !cue.to{false}(at: 2) is its reveal.falselocklockedfalselayergroupgroup: 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.xyplanedxdy.field-componentdydx.field-component#Derived attributes
Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.
valuecolour: follows as #self.value: colour: #self.value -> 0..5 -> temperature pins the strengths the ramp spans.#Allowed in
#Examples


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]
)

graph{
field(slope: x - y)
}(
x-domain: [-4, 4]
y-domain: [-4, 4]
)

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'$
)

graph:argand{
field(f: z^2 - 1; colour: temperature)
}(
re-domain: [-2, 2]
im-domain: [-2, 2]
)