/******************************************* * Copyright (C) 1990 by Christopher R. Wren and * the Massachusetts Institute of Technology * * COMMERCIAL DISCLAIMER: * * This software is intended for research purposes only and contains * unlicensed software, in original and modified forms, from various * sources including the Free Software Foundation. These programs * shall not be used, rewritten, or adapted as the basis of a * commercial software or hardware product without first obtaining * appropriate licenses from the owners of the original software * copyrights. * * In the case of copyrighted software fragments obtained from the * Free Software Foundation: you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as * published by the Free Software Foundation. This software is * distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General * Public License for more details. You should have received a copy * of the GNU Library General Public License and the GNU General * Public License along with this software; if not, write to the Free * Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * * Developed by Christopher R. Wren at the * Media Laboratory, MIT, Cambridge, Massachusetts. * *******************************************/ #include #include #include "/users/cwren/starbase/complex.c" #define f(x) Csub(Cmul(x,Cmul(x,Cmul(x,x))),Complex(1,0)) #define fp(x) Cmul(x,Cmul(x,Cmul(x,Complex(4,0)))) main() { fcomplex w,x,y,z; float D=0.001; x=Complex(-0.5,0.1); y=Complex(100.0,100.0); while (fabs(Cabs(x)-Cabs(y)) > D) { y.r = x.r; y.i = x.i; z=Cdiv(Csub(Cmul(x,Cmul(x,Cmul(x,x))),Complex(1.0,0.0)), RCmul(4.0,Cmul(x,Cmul(x,x)))); x = Csub(y,z); } printf("%f %f\n",x.r,x.i); }