I'm getting a wrong solution for this series: (-1/4)^(n+1)*(z-1)^n
For |z-1|<4
should the series tend to converge to -1/3+z
For z=0.5
should be the solution -2/7
, but if i try to plot with c, the result is 0...
Here is my code:
#include <stdio.h>
#include <math.h>
int main(){
double sum=0;
int n;
for(n=0;n<=100000;n++){
sum+=pow((-1/4),(n+1)) * pow((0.5-1),n);
}
printf("sum= %f\n",sum);
}