for regular series caluclation
we could use this
{
double summand = 1;
int n = 1;
double sum = 1;
do
{
summand = summand * x / n;
sum = sum + summand;
n--;
}
while (summand > 0.00001);
return sum;
}
i.e for e^x= 1+x+(x^2)/2! + (x^3)/3! ....... so on
how would u change the above code if
e^x= 1-x+(x^2)/2! - (x^3)/3! +(x^4)/4! - (x^5)/5! ....... so on
in which the sum is alternated ... any help would be great ...
cheers