Plotting the quadratic function y=ax2+bx+c
Here we are going to use the code we mentioned before to
create a program that plots the quadratic function. Inside the program, you can change
the values a, b and c to change the look of the function. You can also change the
values of xb, xe, yb, and ye to change the viewable area of the graph.
Sounds confusing?? Let's take an example. Suppose that you want to plot your
function on the range from x = -10 to x = 10, you can simply change the value of xb to
-10 and xe to 10. To assure that you can view the whole function on that range, set
the values of yb and ye to proper values. i.e, put ye = f(xe) and yb = f(xb), where
f( ) is your function.
Now, what about this panning thing?? Let's change xb to 10 and xe to 30, you have
just panned or scrolled through the function. Let's change xb to 15 and xe to 20.
C'est la!! You have zoomed into the function. Try it yourself, and you will be
amazed how easy it is.
Now let's go into the code...
You can copy the above code and paste it into your C compiler, or you
may download the PC executable file by clicking here.