04 January 2011

It works! IT WORKS!!

Here is a pdf of an eighth
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();
}

03 January 2011

Making better science

Three quotes from an article html-titled "The Decline Effect and the Scientific Method": The Truth Wears Off in the New Yorker. In light of my musings last night, a few quotes stood out particularly:

1.

The situation is even worse when a subject is fashionable. In recent years, for instance, there have been hundreds of studies on the various genes that control the differences in disease risk between men and women. [...] But the most troubling fact emerged when he looked at the test of replication: out of four hundred and thirty-two claims, only a single one was consistently replicable.
2.
He notes that nobody even tries to replicate most science papers—there are simply too many. (According to Nature, a third of all studies never even get cited, let alone repeated.)
3.
In a forthcoming paper, Schooler recommends the establishment of an open-source database, in which researchers are required to outline their planned investigations and document all their results. “I think this would provide a huge increase in access to scientific work and give us a much better way to judge the quality of an experiment,” Schooler says. “It would help us finally deal with all these issues that the decline effect is exposing.”
4.
The disturbing implication of the Crabbe study is that a lot of extraordinary scientific data are nothing but noise. [...] The problem, of course, is that such dramatic findings are also the most likely to get published in prestigious journals, since the data are both statistically significant and entirely unexpected. Grants get written, follow-up studies are conducted. The end result is a scientific accident that can take years to unravel.

Peer review is obsolete

In a provocative mood of evening musings:

I don't think peer review is working particularly well for showcasing the best work in higher-ranking journals. I suspect there are common flaws in duplications of work, overstatements, etc. A small number of overworked reviewers with little immediate feedback will inevitably let things slip through - especially for more interdisciplinary papers, which have a broader range of things that might go wrong outside the reviewers' specialties.

Having a reviewer check work is terrible efficiency, now that typesetting programs allow for more intermediate steps to be easily incorporated, print page limitations are no longer an issue, and the background code can be bundled along with things. And papers should be "living" - corrected and updated continuously, rather than just in one early cut.

What do we need? Central storage repositories for projects that can be trusted to be long term resources as academics migrate from post to post or leave for different fields entirely. Filtering based on citations and references - what is actually used? The ability for social network style "liking" of papers if they explain things cleanly.

Go deeper - can we have people sign their names to checking a particular derivation, reproducing a result? Then there is public attribution of those who have checked things carefully and staked their names on it. "Liked" "Used" and "Reproduced" can all be done based on interest. Good work should rise by all three attributes.

Still useful are editors (professional as well as impromptu) to collect sets of "most interesting" papers in particular subjects and curate histories of topics. Most interesting are not necessarily the most recently created - new shifts in subject matter can bring renewed interest to decades-old work.

01 January 2011

Papercraft spacetime: An equatorial slice through Schwarzschild

Take a sheet of paper and ignore it's thickness. Welcome to a slice of flat spacetime! It's even persisting through time, so we have three of the dimensions in the paper. We've only ignored one.

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.