hey guys:
i put a question 2 days ago after having a problem with this equation and u guys helped me alot and solved it but i want to program it in java everything went well but gave me 2 errors here is the code and all information the code suppose to find the root of this equation "X cube minus 3X plus 1" on [0,1] after 5 iterations "Bisection Method"
import java.lang.*;
import java.util.*;
public class abc
{
public static void main(String[] args);
{
int max=5;
double EPS=0.01;
double f(double x)
{
return ((x*x*x)-(3*x)+1);
}
double A,B,root;
System.out.println("enter 2");
System.out.println("A :");
A=console.nextInt();
System.out.println("B :");
B=console.nextInt();
root = bisect(a,b);
System.out.println("root is "+root);
}
double bisect(double a,double b){
int n;
double c;
for(n=1;n<max;n++){
c=(a+b)/2.0;
if(fabs(f(c))<EPS) break;
if(f(a)*f(c)<0.0) b=c;
else a=c;
}
return c;
}
}
errors info:
2 errors found:
File:....\mp\mypros\mypros\abc.java [line: 10]
Error: ';' expected
File: ....\mp\mypros\mypros\abc.java [line: 10]
Error: ';' expected
and thank you so much