Vector Field Generator - Differential Equation & Phase Portrait Plotter

An advanced, fully client-side 2D vector field generator designed to visualize systems of autonomous differential equations and phase portraits. Powered by a dual-engine JavaScript and Python (SymPy/NumPy) architecture, this tool offers real-time quiver plots alongside dynamic, particle flow animations. Perform critical vector calculus operations-including divergence, curl, and symbolic equilibrium point detection-instantly within your browser without relying on external servers.

The Vector Field & Differential Equation Plotter

Instantly visualize 2D vector fields, phase portraits, and the flow of differential equations with real-time particle animation.

Visualization


Viewing Window (Domain & Range):

Function Input

Math Engine Selector:
Note:

JavaScript is the default engine for instant calculations. For higher precision and advanced features, you can switch to the Python engine. Please note that Python requires a one-time setup of 10 - 20 seconds, depending on your connection speed. Wait for the "Ready" message to appear before continuing your work.

Quick Start Guide:
  • Set Velocity: Type your horizontal and vertical equations into the dx/dt and dy/dt boxes. The grid will update instantly.
  • View Details: Use the Viewing Window inputs to set specific Domain (X) and Range (Y) limits.
Analysis & Calculus:
  • Vector Grid: The static arrows represent the direction and magnitude (speed) of the flow at specific coordinate points. Longer/brighter arrows indicate stronger forces.
  • Flow Field (Pro): Toggle the animation switch to drop hundreds of virtual particles into the field. This uses Runge-Kutta integration to trace the exact continuous path of the differential equations over time.
Syntax Cheat Sheet:
^ : Exponents (x^2)
sqrt() : Square Root
abs() : Absolute Value
pi, e : Constants
sin, cos, tan : Trig
log, exp : Logarithms
Pro Examples:
Perfect Vortex: dx=-y | dy=x
Saddle Point: dx=x | dy=-y
Magnetic Dipole: dx=2*x*y | dy=y^2-x^2
Gravity Sink: dx=-x | dy=-y
Inward Spiral (Drain): dx=-y-0.1*x | dy=x-0.1*y
Outward Spiral: dx=-y+0.1*x | dy=x+0.1*y
Ideal Pendulum: dx=y | dy=-sin(x)
Van der Pol Oscillator: dx=y | dy=(1-x^2)*y-x
Perfect Limit Cycle: dx=x*(1-x^2-y^2)-y | dy=y*(1-x^2-y^2)+x
Predator-Prey: dx=x-x*y | dy=x*y-y
Twin Sinks (Bistable): dx=x-x^3 | dy=-y
Duffing Oscillator: dx=y | dy=x-x^3-0.2*y
Fluid Shear Flow: dx=y | dy=0
Non-linear Wave: dx=cos(y) | dy=sin(x)
Quadrupole Field: dx=x^3-3*x*y^2 | dy=3*x^2*y-y^3
Explosive Source: dx=x | dy=y
Trigonometric Lattice: dx=cot(y) | dy=sec(x)
Asymptotic Warp: dx=sec(x) | dy=tan(y)
Cosecant Funnels: dx=csc(x) | dy=cos(y)
Ideal Dipole: dx=(x^2-y^2)/(x^2+y^2)^2 | dy=(2*x*y)/(x^2+y^2)^2
Duffing Oscillator: dx=y | dy=x-x^3-0.15*y
Ideal Pendulum: dx=y | dy=-sin(x)

                

            
Download Options

Copy

Introduction to the Vector Field and Differential Equation Plotter

The Vector Field Generator is a rigorous computational tool engineered for the visualization and analysis of two-dimensional vector fields and systems of ordinary differential equations (ODEs). By evaluating coupled equations governing horizontal and vertical velocities—expressed as dx/dt = P(x,y) and dy/dt = Q(x,y)—the engine maps complex dynamical systems onto a Cartesian phase plane. Designed for physicists, engineers, and applied mathematicians, this plotter bridges the gap between static vector calculus and dynamic system simulation. It provides a comprehensive suite for analyzing flow fields, identifying topological features, and extracting highly precise analytical metrics without the overhead of heavy desktop software.

Mathematical Theory and Vector Calculus Analysis

Analyzing a vector field requires both macro-level geometric visualization and micro-level calculus operations. The engine employs distinct mathematical methodologies to parse, map, and interrogate the user-defined vector space.

Systems of Differential Equations and Phase Portraits

At its core, the tool constructs a phase portrait: a geometric representation of the trajectories of a dynamical system in the phase plane. The engine generates a discretized spatial grid (governed by the user's vector grid density parameters) across the specified domain. At each coordinate node, the system evaluates the partial differential functions to determine the instantaneous velocity vector. These vectors are rendered as a "quiver plot," where the orientation of the arrows indicates the direction of the flow, and the normalized length and color intensity represent the magnitude of the force at that specific coordinate. This global view instantly reveals the system's topological skeleton, exposing attractors, repellers, limit cycles, and saddle points.

Vector Calculus: Divergence and Curl

To analyze the localized behavior of the vector field, the engine performs numerical differentiation at the origin (0,0). It calculates two fundamental operators of vector calculus:

  • Divergence: Mathematically defined as the dot product of the del operator and the vector field, divergence measures the magnitude of a vector field's source or sink at a given point. The engine utilizes a central difference numerical approximation method to calculate this flux, indicating whether the field is expanding outward (positive divergence) or compressing inward (negative divergence) at the origin.
  • Curl: Defined as the cross product of the del operator and the vector field, curl measures the infinitesimal rotation or "vorticity" of the field. The engine approximates this localized angular velocity, allowing users to instantly identify irrotational fields (where curl equals zero) or pinpoint the axis of macro-circulation.

Analytical Equilibrium Points via Symbolic Computation

A critical component of non-linear dynamics is identifying equilibrium points—the specific spatial coordinates where the system is at absolute rest (where both dx/dt = 0 and dy/dt = 0). Rather than relying on inaccurate graphical estimations, this tool invokes a symbolic mathematics engine to solve the coupled equations algebraically. By parsing the user's input into symbolic mathematical objects, the engine can find exact, analytical roots for the system, exposing the fundamental anchor points around which the vector field organizes itself.

Dynamic Flow Field Animation and Numerical Integration

While static quiver plots outline the geometry of a field, understanding fluid dynamics and particle kinematics requires temporal simulation. The tool features a high-performance "Pro Mode" animation engine that drops hundreds of virtual particles into the vector space.

To trace the continuous paths of these particles over time, the engine relies on first-order numerical integration (the Euler method). In each programmatic frame, the engine calculates the localized velocity vector for every active particle and updates its positional coordinates by scaling the velocity by a fixed time-step (dt). To visualize flow history, the engine stores a trailing array of positional data for each particle, rendering a fading "comet tail" that illustrates the immediate trajectory. Particles are assigned localized lifespans; as they expire or exit the viewing window, the engine respawns them at random coordinates to maintain a continuous, ergodic representation of the system's flow density.

Advanced Technology Stack: Dual-Engine Architecture

Rendering thousands of dynamic particles alongside rigorous symbolic calculus demands a highly optimized, fully client-side microservices architecture.

JavaScript, Math.js, and Layered Canvas Rendering

For immediate, real-time feedback, the default engine relies on standard JavaScript paired with the Math.js library. This handles rapid lexical parsing and floating-point evaluation. The visual architecture utilizes a layered DOM approach. The static quiver plots and Cartesian axes are rendered using Plotly.js, leveraging WebGL for hardware-accelerated SVG generation. Superimposed directly over this layer is a transparent HTML5 Canvas element. The particle animation loop executes exclusively on this Canvas layer, allowing the engine to redraw 600 moving particles at 60 frames-per-second without triggering heavy, lag-inducing DOM repaints in the underlying Plotly graph.

WebAssembly Python: NumPy and SymPy Integration

When the user switches to the Python engine or requests analytical equilibrium points, the application dynamically loads Pyodide, compiling CPython to WebAssembly. This unlocks two massive scientific libraries directly within the browser:

  • NumPy: For the quiver plot generation, the equations are evaluated using NumPy's vectorized array operations (such as np.meshgrid), allowing the engine to process thousands of coordinates in a fraction of a second using optimized C-backend mathematics.
  • SymPy: To find the equilibrium points, the tool dynamically injects the SymPy library. It translates the JavaScript syntax strings into SymPy expressions, effectively running a localized computer algebra system (CAS) to solve the algebraic matrices analytically.

Standout Advantages Over Commercial Systems

Traditional non-linear dynamics software often restricts users with steep licensing fees, cloud-computation latency, and steep learning curves. This visualizer is built on a strict Open Access framework:

  • Zero Server Latency: Because both the Euler numerical integration and the SymPy algebraic solvers run natively on your local hardware via WebAssembly, complex simulations render instantaneously without waiting for a server response.
  • Absolute Privacy: No mathematical models, proprietary algorithms, or user datasets are ever transmitted externally. All computation is strictly client-side.
  • Export and Reporting: The tool features a safe-export wrapper that temporarily suspends the Canvas animation, captures the underlying mathematical state, and generates a comprehensive PDF report combining the visual graphs with the evaluated analytical metrics.

Practical Applications and STEM Use Cases

The Vector Field Generator is an essential utility across numerous applied sciences:

  • Fluid Dynamics: Visualize laminar and turbulent shear flows, vortices, and sink-source topologies mimicking simplified Navier-Stokes phenomena.
  • Electromagnetism: Model the flux of magnetic dipoles, quadrupoles, and electrical point charges based on Maxwell's equations.
  • Population Biology: Graph Lotka-Volterra equations to understand the cyclical nature of predator-prey dynamics and ecological competition.
  • Chaos Theory and Non-Linear Oscillators: Analyze the phase space of the Van der Pol oscillator, the Duffing oscillator, and ideal pendulum kinematics to locate stable limit cycles and strange attractors.

Related Tools and STEM Resources

To further enhance your computational workflow and explore different mathematical paradigms, seamlessly integrate this differential plotter with our specialized suite of analytical instruments:

Disclaimer: A Note on Performance, Fair Use & Accuracy

How Our Tools Work: 

Our tools are designed for speed and accuracy. Many run instantly in your browser. For advanced statistical analysis (e.g., ANOVA, PCA), we use a high-performance cloud engine to ensure precision. In rare cases where the cloud API is busy, the tool may switch to a backup mode, which takes a few moments to load but guarantees you get your results.

Fair Use Policy: 

These tools are free for educational and research purposes. To ensure availability for everyone, excessive automated requests or scraping are prohibited.

Accuracy Disclaimer

This tool uses industry-standard, open-source scientific libraries to perform its calculations. While we strive for high accuracy, the results are for educational and informational purposes only. All results should be independently verified by a qualified professional before being used for academic publications, medical decisions, or other critical applications.
Learnbin Lab - © 2026 learnbin.net. All rights reserved.