/* muller.c -- Solve f(x)=0 by Muller's Method Written December 14, 2012 by Eric Olson for Math 701 */ #include #include #include #define N 20 typedef double complex Complex; Complex f(Complex z){ return cexp(z)+z; } Complex muller(Complex z[3],Complex w[3]){ Complex c[3]; for(int k=0;k<3;k++) c[k]=w[k]; for(int k=1;k<3;k++) for(int i=0;i<3-k;i++) c[i]=(c[i+1]-c[i])/(z[i+k]-z[i]); Complex b=c[1]+c[0]*(z[2]-z[1]); Complex d=csqrt(b*b-4*c[2]*c[0]); Complex M1=-b+d,M2=-b-d; if(cabs(M1)