CSCE 121 Chapter 15
Jump to navigation
Jump to search
« previous | Monday, October 18, 2010 | next »
Graphing Functions
Function f(func, x_min, x_max, origin, n_points, x_scale, y_scale);
split x_min and x_max into n_points evenly-spaced points, evaluate the function at each of those points, and connect the dots with straight lines to approximate the graph.
x_scale and y_scale: multiply the corresponding x and y of each point to make the graph bigger or smaller
Providing Default Values
Reduce number of arguments:
Function(Fct func, double x_min, double x_max, Point origin, int n_points = 100, double x_scale = 25, double y_scale = 25) { /* ... */ }
<cmath>
Lots of mathematical goodness!
- trig functions
- exponentials and logarithms
- hyperbolic functions