DGS Studio

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

Graph preview of streamlines(-y,x,z)
A static sample of this expression. The studio draws the full interactive result.

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

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

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.

Edit and generate

Generate Graph opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples