Editing LogZp1oZm1

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 19: Line 19:
 
     for minor speed gains.
 
     for minor speed gains.
 
  Modified 2008 01 11 by Ph. Le Grand:
 
  Modified 2008 01 11 by Ph. Le Grand:
     Reduced some operations for minor speed gains,
+
     Reduced some operations for minor speed gains.
    used atan2, for speed and reduction of logic.
 
 
  -------------------------------------------------------------------------------*/
 
  -------------------------------------------------------------------------------*/
 
  inline cmplex logZm1oZp1(const cmplex &Z)
 
  inline cmplex logZm1oZp1(const cmplex &Z)
Line 27: Line 26:
 
  double y(Z.imag());
 
  double y(Z.imag());
 
  double r2=x*x+y*y;  
 
  double r2=x*x+y*y;  
+
double den(r2+x+x+1.0);
  return cmplex(0.5*log(1.0-4.0*x/(r2+x+x+1.0)),
+
double add=0.0;
        atan2( y+y, r2-1.0 ));   
+
if ((r2)<1.0){
 +
add=-PI;
 +
if (y>=0.0){add=PI;}
 +
}
 +
  return cmplex(0.5*log(1.0-4.0*x/den),
 +
        add+atan( (y+y) /(r2-1.0) ));   
 
  }
 
  }

Please note that all contributions to AEMWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see AEMWiki:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)