Math Graph

Write a program to draw a straight-line graph given by the formula y = mx + c.  Use the canvas to draw and label a set of axes.  Allow the user enter values for c and m and draw the graph accordingly.  Note that the canvas sets point (0,0) at the top left corner of the canvas.  You must position the axes in the centre of the form.  You will have to maintain an offset value for the x-axis and one for the y-axis.

Variations: Allow the program to draw any shape graph by simply testing every point on the canvas to see if it satisfies the formula, then plot a point.

If you are working in Python this is a good chance to use Plotly.

Credit Blundell@MonktonCoombe

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.