/* * functions.c - these little functions are intended as arguments to plot(). * See plot.c. */ #include #include "functions.h" double identity(double y) { return y; } double odd(double y) /* basically, says whether or not floor(y) is odd */ { int i = floor(y); if (i % 2 == 0) return -999; else return y; } double square(double y) { return y * y; } double sine(double y) { return 3 * sin(y); } double cubic(double y) /* y**3 - 2y + 1 */ { return (y * y * y - 2 * y + 1) ; }