See the Pen Plot of Complex Number Function by kob58im (@kob58im) on CodePen.
画面左側がz平面で、画面右側がf(z)平面
複素関数計算部分のソースコード抜粋
// parameter c is [real part, imaginaly part]
// it means c[0] is real part,
// c[1] is imaginaly part.
function mul(c,d){
return [c[0]*d[0]-c[1]*d[1],c[0]*d[1]+c[1]*d[0]];
}
// 1/c
function inv(c){
let t = abs2(c);
return [c[0]/t,-c[1]/t];
}
// add
function add(c,d){
return [c[0]+d[0],c[1]+d[1]];
}
function exp(c){
let r = Math.exp(c[0]);
return [r*Math.cos(c[1]),r*Math.sin(c[1])]
}
// return real number -pi to pi
function arg(c){
return Math.atan2(c[1],c[0]);
}
// return real number abs(c)^2
function abs2(c){
return c[0]*c[0]+c[1]*c[1];
}
function log(c){
return [Math.log(abs2(c))*0.5,arg(c)];
}
function pow(c,d){
// c^d = exp(d*log(c))
return exp(mul(d,log(c)));
}