Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet - Graphing Quadratic Function Help

 
Josh Crawford
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Sheriff
Pie
Posts: 50247
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Josh Crawford
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Sheriff
Pie
Posts: 50247
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

I've explored the java.awt.geom package
And you didn't find the QuadCurve2D classes?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 50247
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Sorry.


Maybe it's a good idea to think about tangents
 
Campbell Ritchie
Sheriff
Pie
Posts: 50247
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from Jeff Albertson. Maybe it's a good idea to think about tangents
Agree.


Better than my flying off at a tangent.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic