# Applet - Graphing Quadratic Function Help

Josh Crawford

Greenhorn

Posts: 11

posted 9 years ago

Hi!

Im making an applet to graph a quadratic function...now im not going to be rude and say "tell me how to do it!" but i was just wondering if i could get some assistance on making it...

Now of course, i've had a go at it, and i've made an applet to display the z intercepts, y intercept, and vertex (turning point). This is determined by the user inputs of the three coefficients a, b, and c.

First question, is this all the information i will need?

Secondly, i am struggling to figure out how to put this information into a graph and make it a parabola...

Thank you very much for your help!

Ps. my applet is below if you wish to have a look, i've made a crude graph if that helps as well...

-Crawf

Im making an applet to graph a quadratic function...now im not going to be rude and say "tell me how to do it!" but i was just wondering if i could get some assistance on making it...

Now of course, i've had a go at it, and i've made an applet to display the z intercepts, y intercept, and vertex (turning point). This is determined by the user inputs of the three coefficients a, b, and c.

First question, is this all the information i will need?

Secondly, i am struggling to figure out how to put this information into a graph and make it a parabola...

Thank you very much for your help!

Ps. my applet is below if you wish to have a look, i've made a crude graph if that helps as well...

-Crawf

Campbell Ritchie

Sheriff

Posts: 48363

56

posted 9 years ago

Morning.

You are trying to do two things at the same time; shouldnt' these be in different classes?

You seem to have the method for solving a quadratic equation worked out, also drawing a graph on screen.

As for finding curves, have you explored the java.awt.geom package in the API yet? You might find something to your advantage there.

CR

You are trying to do two things at the same time; shouldnt' these be in different classes?

You seem to have the method for solving a quadratic equation worked out, also drawing a graph on screen.

As for finding curves, have you explored the java.awt.geom package in the API yet? You might find something to your advantage there.

CR

Josh Crawford

Greenhorn

Posts: 11

posted 9 years ago

Yeah, they probably should be in two different classes, but im doing this for a school assignment, and the teacher isnt expecting anything brilliant, he wants it VERY simple, but it would make things easier that way hey?

I've explored the java.awt.geom package, but found nothing as to what i am trying to achieve unfortunately...is there another way to plot each point onto the graph and and draw lines from each point. wouldnt that be easier? maybe...

Thanks!

-Crawf

I've explored the java.awt.geom package, but found nothing as to what i am trying to achieve unfortunately...is there another way to plot each point onto the graph and and draw lines from each point. wouldnt that be easier? maybe...

Thanks!

-Crawf

Campbell Ritchie

Sheriff

Posts: 48363

56

posted 9 years ago

When I was a beginner in my first Java course, we were expected to have the correct number of classes from the very beginning. But now you have got this far without dividing into separate classes, finish it this time, and use more classes for your next exercise.

And you didn't find the QuadCurve2D classes?I've explored the java.awt.geom package

Jeff Albertson

Ranch Hand

Posts: 1780

posted 9 years ago

It's not quite that easy -- QuadCurve2D is a quadratic parametric curve, not just a simple quadratic function. The OP would have to think a bit about tangent lines to calculate the control point...

[ June 08, 2006: Message edited by: Jeff Albertson ]

Originally posted by Campbell Ritchie:

When I was a beginner in my first Java course, we were expected to have the correct number of classes from the very beginning.

*Young folks today....*

Originally posted by Campbell Ritchie:

And you didn't find the QuadCurve2D classes?

It's not quite that easy -- QuadCurve2D is a quadratic parametric curve, not just a simple quadratic function. The OP would have to think a bit about tangent lines to calculate the control point...

[ June 08, 2006: Message edited by: Jeff Albertson ]

There is no emoticon for what I am feeling!

Jeff Albertson

Ranch Hand

Posts: 1780