The solution object from Chalkboard.diff.solve or Chalkboard.diff.solveAdaptive
Optionalcontext?: CanvasRenderingContext2DCanvas context
Optionali?: numberx-component index (for phase plots)
Optionalj?: numbery-component index (for phase plots)
OptionallineWidth?: numberStroke width
Optionalphase?: booleanIf true, plots y[j] vs y[i] (phase plot), if false, plots y[i] vs t
Optionalsize?: numberScale, defaults to 1, divided by 100 internally for finer control
OptionalstrokeStyle?: stringStroke color
Optionalx?: numberx-offset (canvas translation), defaults to canvas center
Optionaly?: numbery-offset (canvas translation), defaults to canvas center
// Plot scalar solution y(t)
const ode1 = Chalkboard.diff.exponential(-1);
const sol1 = Chalkboard.diff.solve(ode1, { t0: 0, t1: 5, steps: 300, y0: 1 });
Chalkboard.plot.ode(sol1, { strokeStyle: "red", size: 1 });
// Phase plot for harmonic oscillator (y vs dy)
const ode2 = Chalkboard.diff.harmonic();
const sol2 = Chalkboard.diff.solve(ode2, { t0: 0, t1: 20, steps: 2000, y0: { y0: 1, dy0: 0 } });
Chalkboard.plot.ode(sol2, { phase: true, i: 0, j: 1, strokeStyle: "blue" });
Plots an ODE solution. Supports both scalar and system ODEs. For scalar ODEs, plots y(t). For systems, can plot either y[j] vs t or y[j] vs y[i] (phase plot) based on the "phase" config option.