I wrote this code to find the sum of Riemann given a function, a range and precision that would be n, but when I execute it it returns "2.0E -8", and then in my calculator this is 6.6666666666666
Could you please help me see what is wrong?
class Suma{
public static void main (String[]args){
double x=0;
double y=Math.pow(x,2)+x+1 ;//función en x
double a=0;//cota inferior
double b=2;//cota superior
double n=100000000;
double delta=(b-a)/n;//variación de x
double S=0;//suma
for(int i=1;i<n+1;i++){
x=a+i*delta;
S=+y;
}
S=S*delta;
System.out.println(S);
//Scanner i =new Scanner(System.in);
//n=i.nextInt();
}
}