Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Java Graphing Help
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ddrsakuramax




PostPosted: Sun Nov 01, 2009 3:31 pm   Post subject: Java Graphing Help

Hi,

prof recently gave a project and one part of it consists of graphing a polynomial.

Does anyone have a clue to do this???

we're using Netbeans FYI

Please help! thanks!
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Sun Nov 01, 2009 5:52 pm   Post subject: Re: Java Graphing Help

Some math and AWT should do the trick. If I recall correctly, polynomials have roots, are odd or even and local maxima and minima. Have these points and take the value of the polynomial at intervals to get other points and just draw lines to connect them.
chopperdudes




PostPosted: Mon Nov 02, 2009 10:42 pm   Post subject: RE:Java Graphing Help

well, i guess input the polynomial into the program (i.e. int y = x^3 + 3x^2 + x -4), and then loop thru x values, drawing a dot in the appropriate (x,y) cordinate on the screen.
Superskull85




PostPosted: Mon Nov 02, 2009 11:20 pm   Post subject: Re: RE:Java Graphing Help

chopperdudes @ Mon Nov 02, 2009 10:42 pm wrote:
well, i guess input the polynomial into the program (i.e. int y = x^3 + 3x^2 + x -4), and then loop thru x values, drawing a dot in the appropriate (x,y) cordinate on the screen.

You could do that. However I would think that approach would be very slow, and may show some characteristics of the graph inaccurately. A better approach would be to use Calculus to calculate roots, intercepts, turning points, points of inflection, concavity, etc. From there you could find certain points along the curve to make the output smoother, and than just draw a line between each point.

Of course the Calculus approach requires knowledge of curve sketching, but that would be the best way to do I would think, and if you wanted to extend the program to include support for non-polynomial functions you should be able to. Smile
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: