Cybertronic
Technical User
- May 18, 2006
- 19
Hi all,
I was wondering how can I create a secant method function in Java?
I've seen a few examples of secant methods created in different programming languages such as Fortran:
I've tried converting the code in the above link into Java but unfortunately I've had no success
I've done the function for bisection method in Java which is part of my non-linear equations research:
The above code is only the main part of my bisection method code, could anybody please help me create a secant method in Java please?
I appreciate anybody's assistance
I was wondering how can I create a secant method function in Java?
I've seen a few examples of secant methods created in different programming languages such as Fortran:
I've tried converting the code in the above link into Java but unfortunately I've had no success
I've done the function for bisection method in Java which is part of my non-linear equations research:
Code:
// m = midpoint
// f = function (from Function class)
for (i = 0; i <= max; i++)
{
m = (x0 + x1)/2;
System.out.println(i + "\t" +
x0 + "\t" +
f.apply(x0) + "\t" +
x1 + "\t" +
f.apply(x1) + "\t" +
m + "\t" +
f.apply(m));
if (f.apply(m) < 0)
{
x1 = m;
}
else
{
x0 = m;
}
}
The above code is only the main part of my bisection method code, could anybody please help me create a secant method in Java please?
I appreciate anybody's assistance