Streamlines
3D Streamlines
Draw streamlines(-y, x, z) in the existing 3D viewer. Trajectories spiral about the z-axis. Orbit, zoom, and pan stay on that viewer.
Generate Graph draws streamlines(-y, x, z) in the existing 3D viewer. The horizontal part rotates about the z-axis and the vertical part equals z, so the height changes exponentially in time. Forward in time the trajectory spirals away from the xy-plane. Backward in time it rotates toward that plane. On a regular orbit the distance to the z-axis stays constant. Direction arrows follow the field.
Drag orbits the scene, the wheel zooms, and Shift-drag or right-drag pans. Density and trajectory length redraw the seeds without a new request. Add seed places another initial point. The same card also draws streamlines(-y, x, 0), circles of constant height, and streamlines(x, y, z), rays from the origin. An undefined sample ends the ray. A zero vector does not start a direction.
Equation
streamlines(-y,x,z)
Graph preview
How a streamline is integrated
A streamline is a curve whose tangent is the vector field at every regular point. In the plane it solves dx/dt = P and dy/dt = Q. In space it also solves dz/dt = R. DGS reuses the adaptive Runge-Kutta (Dormand-Prince) step from the differential-equation solver. The independent variable is time, and the state is the point itself. Each seed is integrated forward and backward. The step grows when the local error is small and shrinks when it is not. A proposed step is also limited so the point cannot jump across the window.
The ray stops at the boundary of the view, at a maximum arc length, at a maximum number of steps, at a zero vector, or when a sample is undefined, infinite, or too large. The last valid point is kept. The invalid point is not connected. A closed orbit, such as the circles of F = (-y, x), stops when the point returns to its seed so the same loop is not traced forever. These curves are numerical. They are not a closed-form solution, and a very long requested length is still capped. The field (-y, x, z) rotates about the z-axis while z grows exponentially forward in time.
Reading the input
streamlines(-y,x,z)— This is a command. The name selects the routine, and the items inside the parentheses are its arguments.
Other versions of this example
These stay on this page so each version keeps the same explanation. Choose Try example to run a version in its Studio workflow, or copy it into the editable field below.
Spiral
The horizontal part rotates about the z-axis. Forward in time, z grows. Backward in time, z decays toward the xy-plane.
streamlines(-y,x,z)
Rotation
Circles in planes of constant z. The vertical component is 0.
streamlines(-y,x,0)
Radial
Trajectories are rays from the origin. The origin is an equilibrium.
streamlines(x,y,z)
Try a change
- Move Streamline density and Trajectory length after Generate Graph. The seeds and the arcs change, and each curve stays tangent to the field.
- Click the 2D board to add a seed, or use Add seed for a 3D point. The new trajectory follows the same field.
- Turn on Vector field arrows to show the field beside the curves. Color by magnitude recolors each curve by its speed.
Generate Graph integrates streamlines(P, Q) on the 2D board, or streamlines(P, Q, R) in the existing 3D viewer, with adaptive Runge-Kutta forward and backward. Direction arrows follow the field. Density, length, and optional field arrows redraw locally. A click or Add seed starts another curve. Zoom, pan, orbit, and export stay with those engines. A trajectory is not joined across an undefined sample.