« Thoughts on saving a bitmap to disk from Flash | Main | Stuck in Static When Dynamic is Right There? »

Basic Graphing

For some reason, I can't log into Were-Here today. So, I'm replying to a question here.

I've seen this come up before, and while the answer is simple, it can trip people up...especially if they haven't done a lot of graphing in Math or Science.

Let's say we want to draw a curve, based on an equation. How do we get the x,y values to draw the curve with?

We evaluate the function at certain values of x.

You may see the equation presented in this format: f(x) = 2x - y

To graph this equation, we'll need to rewrite it so that one side has y, all by itself:

y = 2x

Now we decide on a range of values for x, and solve for y at each point:

x=1
y=2(1) = 2

giving us the (x,y) coordinate of (1,2)

x=2
y=2(2) = 4

giving us the (x,y) coordinate of (2,4)

x=3
y=2(3) = 6

giving us the (x,y) coordinate of (3,6)

and so on, until we have all the points we want.

Then we plot these points on a graph, connect the dots, and we're done.