there is requirement to do the summation.............
i want to do it shorter,to reduce the complexity.....
so i was searching for a alternative to replace the no of for loops in my code.
I found a method that is called as sum().
if,it can be implemented in my code...then the code become so easy .....
for summation Refernce to the function is given below
http://science.kennesaw.edu/~plaval/applets/HelpFuncBI.html
sum(expr, index, start, end) finds the partial sum using expr, with the index running from start to end.
it tried it but there is an error which says
the method sum is un defined for math class but it is mentioned in the link above
here is my code
import java.lang.Math.*;
public class sumation {
public static void main(
String args[])
{
int n=10;
int y;
y=Math.sum(n^n/n,n,0,10);
}
}
As there is so many For loops in my requirement so i want to reduce those loops and make the coding easier and simpler.....
if it is not possible please provide me an alternative for doing that.......
for example:-
If there is a series like "n / 2^(n +1)" for n=1 to 100....
is there any way to solve this using the direct fuction which is available in java.......