conformal mapping from circle to cardioid



Hi,

This batch file transforms circle to cardioid using point-to-point method.
This is first solutions of my earlier question : polynomial equations.
Cardioid is a boundary of main (period 1 ) component of Mandelbrot set.


Adam

============= code =====================
/*
conformal mapping from :
the  circle with center=0 and radius=r
  given by equation : abs(2*z)=r
  where : z:x+y*%i=r*cos(t)+%i*r*sin(t);
onto
cardioid
is given by equation:
c:z-z*z;
so
rectform(c);
r^2*sin(t)^2+%i*(r*sin(t)-2*r^2*cos(t)*sin(t))-r^2*cos(t)^2+r*cos(t)

based on :Conformal Mappings And The Area Of The Mandelbrot Set by David 
Allingham page 18
http://www.eng.warwick.ac.uk/staff/doa/reports/allingham-thesis1995.pdf

*/

/* parametric form of circle */
ftx(t,r):=r*cos(t);
fty(t,r):=r*sin(t);


/* conformal mapping */
fx(x,y):=x/(y^2+x^2);
fy(x,y):=y-y/(y^2+x^2);
newftx(t,r):=r^2*sin(t)^2-r^2*cos(t)^2+r*cos(t);
newfty(t,r):=r*sin(t)-2*r^2*cos(t)*sin(t);

iMax:1000;
dt:(2*%pi)/iMax;
r:0.5;

/* point to point method of drawing */
t:0*%pi;
/* compute coordinates  */
x:ftx(t,r);
y:fty(t,r);
newx:newftx(t,r);
newy:newftx(t,r);
/* save coordinates  to draw it later */
xx:makelist (x, i, 1, 1);
yy:makelist (y, i, 1, 1);
newxx:makelist (newx, i, 1, 1);
newyy:makelist (newy, i, 1, 1);

for i:2 thru iMax step 1 do
  block
  ( t:t+dt,
	x:ftx(t,r),
	y:fty(t,r),
	newx:newftx(t,r),
newy:newfty(t,r),
	/* save values to draw it later */
	xx:cons(x,xx),
	yy:cons(y,yy),
	newxx:cons(newx,newxx),
	newyy:cons(newy,newyy)
  );

load(draw);
draw2d(
     file_name = "",
     terminal  = 'screen,
	pic_width  = 500,
     pic_height = 500,
	yrange = [-2,2],
     xrange = [-2,2],
	title= "Conformal mapping from circle to cardioid ",
	key = "circle = {z:abs(2*z)=1}",
	xlabel     = "re ",
     ylabel     = "im",
     point_type    = dot,
     point_size    = 5,
     color         = black,
	points(xx,yy),
	key = "cardioid = {c:c=z-z*z}",
	color         = red,
	points(newxx,newyy)
	
  );

==================== end code =========================