import processing.pdf.*;
int segments = 8;
int radii = 20;
float radiispacing = 20;
float horizon = 80;
float horizondistance(float rf) {
return sqrt(rf*(rf - horizon))
+ 0.5* horizon * log(rf) - 0.5 * horizon * log(horizon)
+ horizon * log(1 + sqrt(1 - horizon/rf));
}
float sqrt_grr(float rf){
return 1.0 / sqrt(1 - horizon/rf);
}
void setup()
{
size(400,600,PDF, "filename.pdf");
// size(400,600);
background(255);
}
void draw(){
translate(width/2,height-radiispacing);
noFill();
line(-PI/segments*horizon,0,PI/segments*horizon,0);
for(float radius = horizon + radiispacing;
radius < horizon + radii*radiispacing;
radius += radiispacing) {
println(radius + " " + horizondistance(radius) + " " + radius*sqrt_grr(radius));
ellipseMode(RADIUS);
//ellipse(0,radius*sqrt_grr(radius)-horizondistance(radius),2,2);
//ellipse(0,
// radius*sqrt_grr(radius)-horizondistance(radius),
// radius*sqrt_grr(radius),
// radius*sqrt_grr(radius));
arc(0,
radius*sqrt_grr(radius)-horizondistance(radius),
radius*sqrt_grr(radius),
radius*sqrt_grr(radius),
-PI/2.0-PI/segments/sqrt_grr(radius),
-PI/2.0+PI/segments/sqrt_grr(radius)
);
}
exit();
}
04 January 2011
It works! IT WORKS!!
01 January 2011
Papercraft spacetime: An equatorial slice through Schwarzschild
Now think about a equatorial slice through Schwarzschild. There's curvature: the usual coordinates use a circumferential radius coordinate, so r is the distance around a circle at that point divided by 2π. On the flat paper, if we draw a bunch of concentric circles around a point, each one has a distance r to the centre and a circumference 2πr. And then the distance between a circle at r1 and a circle at r2 is r1-r2. But in Schwarzschild it's different: the distance between two circles is
which is longer than r1-r2, by a little bit far away from the center, increasing toward the horizon.
So let's make a slice of schwarzschild out of paper!
Version 1: This is not perfect, but I thought that the programming environment Processing would be good for this and some other little ideas I have.
I figured that I would divide the spacetime slice around the centre like a pie and figure out the shape of each chunk, then tape them together. So the first step was to figure out how I might draw a slice in flat spacetime:
void setup()
{
size(400,400);
background(255);
smooth();
int segments = 16;
int radii = 10;
int centrex = 200;
int centrey = 350;
float spacing =30;
stroke(128);
for(int i= radii; i>0; i--){
arc(centrex,centrey,2 * spacing *i,2* spacing*i,-PI/2 - PI/segments,-PI/2+ PI/segments);
line(centrex-spacing*(i-1)*sin(PI/segments),
centrey-spacing*(i-1)*cos(PI/segments),
centrex-spacing*i*sin(PI/segments),
centrey-spacing*i*cos(PI/segments));
line(centrex+spacing*(i-1)*sin(PI/segments),
centrey-spacing*(i-1)*cos(PI/segments),
centrex+spacing*i*sin(PI/segments),
centrey-spacing*i*cos(PI/segments));
}
}
And then, keep the arcs to make the same circumference of circle, but add extra linear spacing so that they follow the Schwarzschild relationship (note: math needs to be double checked)
void setup()
{
size(400,800);
background(255);
smooth();
int segments = 8;
int radii = 20;
int centrex = 200;
int centrey = 700;
float basespacing =20;
float horizon = 80;
stroke(128);
float oldx = centrex-(horizon+ radii * basespacing) * sin(PI/segments);
float oldy = centrey-(horizon+ radii * basespacing)*(cos(PI/segments));
for(float radius = horizon + radii*basespacing; radius >= horizon; radius = radius - basespacing){
// The spacing is modified to shift circumference
// circles up so they are the appropriate distance from the horizon
float horizondist = sqrt( radius * (radius - horizon) )- 0.5*horizon*log(horizon/radius)
+ horizon * log(1 + sqrt(1-horizon/radius));
println(radius + " "+(radius-horizon) + " "+(horizondist));
arc(centrex,centrey-horizondist+radius,2 *radius,2*radius,-PI/2 - PI/segments,-PI/2+ PI/segments);
float newx = centrex - radius * sin(PI/segments);
float newy = centrey-horizondist+radius - radius * cos(PI/segments);
line(oldx,oldy,newx,newy);
line(-oldx+2 *centrex,oldy,-newx+2*centrex,newy);
oldx = newx;
oldy = newy;
}
}
But this isn't quite right, because the lowest arc, which is the horizon, at which point the proper distance between two radial coordinates blows up - doesn't need to be an arc. The paper will be curved down into a funnel shape here, and a flat bottom of the paper will curve around with all the pieces stuck together. So some of the arc-ness is coming from the change in angle of the sides in the curved space time, and I need to take that into account.
