Skip to main content
Participant
July 28, 2013
Question

Drawing quadratic equations on a 2D cartesian co-ordinate system

  • July 28, 2013
  • 1 reply
  • 599 views

Hi,

I need to design a 2D cartesian co-ordinate system to plot quadratic equations on the graph using pure action script. Quadratic equations are of the form y = ax^2 + bx + c where a,b and c are the variables for which the values need to accepted from the user as input. Accordingly, the curve needs to be plotted on the graph.

Could anybody kindly help me to write an action script 3.0 code to suffice the above requirement?

Thanks in advance.

Cheers,

Pratik.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
July 28, 2013

that will take more work than doable in a forum.  to start, you need to find the roots of your equation (use the quadratic formula) and make sure the real roots are towards the center of your x-axis.  the two parts where y tends towards (+infinity or -infinity) do not require much display.

if there is only 1 or 0 roots, put that equation in vertex form and use an x-axis centered around the vertex.

for a sample of how this can be done:  http://www.kglad.com > snippets > function graphs.