/* -*-ePiX-*- */ #include "epix.h" using namespace ePiX; double MAX(2*M_PI); double f(double t) { return t*Sin(t); } int main() { picture(P(-MAX,-MAX), P(MAX,MAX), "240x240pt"); begin(); // Coordinate axes and labels pen(Black(0.3)); grid(8,8); font_size("scriptsize"); // trigonometric axis labels bottom_axis(4, P(0,-4)).trig().draw_labels(); left_axis(4, P(-4,0)).trig().draw_labels(); legend L; L.item_border(0).border(Red(), 0.4); bold(Black()); plot(f, xmin(), xmax(), 90); L.path_item("$y=x\\sin x$"); pen(Green()); plot(Deriv(f), xmin(), xmax(), 90); L.path_item("$y=\\frac{d}{dx}(x\\sin x)$"); pen(Blue()); plot(Integral(f, 0), xmin(), xmax(), 90); // definite integral from 0 L.path_item("$y=\\int_0^x t\\sin t\\,dt$"); L.draw(P(0,2*M_PI), P(2,-2), br); end(); }