Recent content by Lijnk

  1. L

    Solving N-Body Simulation Problems with Gravitational Equations

    The reason I put pow(a, -1) is because 1/a did some weird things previously (although it's most likely just me). I'll be fixing a lot of things up with that function such as optimization as well as the Y component still needs work done on my part as well. I'll probably end up redoing the entire...
  2. L

    Solving N-Body Simulation Problems with Gravitational Equations

    I did some experimentation while I was away and came to the exact conclusion. I fixed it up. It's a cluster of a function now :smile:. void forceInit() { int i, j; double rx=0, ry=0, r1=0, r2=0; for(i=0;i<N;i++) { for(j=0;j<N;j++) { if(j==i) continue; r1 =...
  3. L

    Solving N-Body Simulation Problems with Gravitational Equations

    I've narrowed the problem down to the fact that the forces are always adding and never subtracting. I'm not completely sure why that is. I'm going to take the question elsewhere since this seems to be more programming rather than physics at the moment (I've fixed an error that was physics...
  4. L

    Solving N-Body Simulation Problems with Gravitational Equations

    I'm having problems with an n-body simulator. I tried to use the gravitational equation for vectors, however that didn't exactly work, so I split up the forces into their respective X and Y components and used two separate gravitational equations. The problem is the entire body is exploding...
Back
Top