next up previous contents index
Next: Recursive Fractal Curves Up: Domains and Plotting Previous: Utility Functions   Contents   Index

Calculus Plotting

ePiX can plot the derivative or definite integral of real-valued functions, solve ODEs in two or three variables, and graph slope- or vector fields. Let f be a real-valued function of one variable, F a P-valued function of two or three variables.

  plot(D(f), a, b, n);  // plot f' over [a,b]
  plot(I(f, x0), a, b, n);

  ode_plot(F, p_0, t_min, t_max, n); 
  flow(F, p_0, t_max, n);
The second command graphs the definite integral $ x\mapsto\int_{x_0}^x
f(t)\,dt$ over $ [a,b]$. As above, $ x_0$ defaults to 0.

The third command plots the solution curve of the initial-value problem $ \dot{x}=F(x)$, $ x(0)=p_0$, over the specified time interval. If $ t_\mathrm{min}$ is omitted, its value is 0, so the curve starts at $ p_0$. With manual calculation to rotate a planar field a quarter turn, ode_plot can be used to draw level curves (isobars) of a function; see the sample file dipole.xp. The fourth command returns the result of starting at $ p_0$ and flowing by $ F$ for time  $ t_\mathrm{max}$, using Euler's method with $ n$ timesteps. This is useful for placing markers or arrowheads precisely along a flow line. A vector field itself may be drawn in three ways:

  vector_field(F, p, q, n1, n2); // proportional length
  dart_field  (F, p, q, n1, n2); // constant length
  slope_field (F, p, q, n1, n2); // directionless, const length
The field is sampled at the grid points of the coordinate rectangle whose corners are specified.


next up previous contents index
Next: Recursive Fractal Curves Up: Domains and Plotting Previous: Utility Functions   Contents   Index
Andrew D. Hwang 2004-09-04