Sketching graphs

579 Views Asked by At

How are graphs plotted or sketched?

If you have a graph plotting software for example mathematica or matlab, or you want to see what the graph of $e^{2x}$ looks like, how do you plot/sketch such a graph?

If you proceed by using a finite number of points, and "extrapolating" and "interpolating", then how do you know that that method is reliable? There are infinitely many smooth(or non-smooth) graphs that can be drawn through a finite number of points.

1

There are 1 best solutions below

2
On BEST ANSWER

Basically (keyword: "basically"), it works like this:

BEGIN
    DECLARE x
    SET x TO x1
    WHILE x IS LESS THAN TO x2
        DRAW LINE BETWEEN f(x) and f(x-step)   // "linear interpolation"
        INCREASE x BY step
    END WHILE
END

Where step is some small number... Something like 0.01, depending on how fast you want it. $step = \lim_{x\to 0^+}$ would be "perfectly smooth", but we don't have the resources for such measures, so we're stuck with anything between $10^{50}$ and $10^{-50}$.

They won't be "infinitely smooth". That would require infinite amounts of RAM and CPU. It only has to "look" smooth. It's only limited by your RAM/CPU, time (unless you feel like waiting a few trillion years), and most importantly, your screen resolution.

More complex plotters can determine the vertical asymptotes, but I don't need to get into that.