In this section, f and g are double-valued functions of one variable. ePiX defines numerical functions that return the maximum or minimum value on an interval, approximate the location of roots, and perform calculations with derivatives and definite integrals.
sup(f, a, b); // max/min of f on [a,b] inf(f, a, b); newton(f, g, x0); // find approximate crossing pointNewton's method returns the crossing point of the given functions, starting from the specified seed. If a critical point is hit or 20 iterations pass, a warning is issued and the current result (probably incorrect) is returned. The second function
The classes D and I are used to calculate values of derivatives and integrals, and to plot these functions.
D df=D(f); // data structure representing the derivative df.eval(t); // return f'(t) df.left(t); // deriv from left at t: (f(t)-f(t-dt))/dt df.right(t); // deriv from right at t: (f(t+dt)-f(t))/dt I prim=I(f,a); // representation of the integral from a prim.eval(b); // numerical integral of f over [a,b] double val=I(f).eval(1); // \int_0^1 fThe lower limit on an integral is 0 by default.
Tangent lines and envelopes (families of tangent lines) are drawn with
tan_line(f, t); // f real- or vector-valued envelope(f, t_min, t_max, n); // family of tangent lines tan_field(f1, f2, t_min, t_max, n); // field of tangentsThe sample files conic.xp and lissajous.xp illustrate these features.