File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Root Finding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Root Finding" Watch "Root Finding" New topic
Author

Root Finding

john mater
Greenhorn

Joined: May 08, 2009
Posts: 23
I have been set an assignment to develop functions newton and bisection which use these methods to find the roots of functions. I have a function class a testfunction class and a root class, im having trouble bringing everything together.. if someone could take a look over what ive got i'd be grateful.






Function class was given to us and I dont really understand how to use it.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
Go through the code in the (badly-named) Function class and see what the different options in the apply() method do. They appear to work out formulae of the x^3 + 3x^2 - 5x - 3 variety. And don't use Math.pow(x, 3) for cube. Use x * x * x.
john mater
Greenhorn

Joined: May 08, 2009
Posts: 23
Thanks, noted and changed.. how do I go about creating a test class with some arbitrary starting values and a function from Function which tests my root finding methods?
john mater
Greenhorn

Joined: May 08, 2009
Posts: 23
Someone please help as this code is driving me crazy.. I have two Classes Function and Roots:





My question is how do I modify Roots to call/use the functions created by my Function class? Thanks
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38472
    
  23
Does that class compile? Please tell us the details of what actually happens.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Root Finding