| 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: 32712
|
|
|
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: 32712
|
|
|
Does that class compile? Please tell us the details of what actually happens.
|
 |
 |
|
|
subject: Root Finding
|
|
|