Skip to content

Commit

Permalink
update n-body
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jan 25, 2018
1 parent 11679e5 commit 506d812
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/src/models/physical.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ODEs defined by Hamiltonians is described in the
## N-Body Problems

```julia
nprob = NBodyProblem(f, mass, pos, vel, tspan)
nprob = NBodyProblem(f, mass, vel, pos, tspan)
```

where `f` is the potential function, `mass` is the mass matrix, `pos` and `vel`
Expand Down Expand Up @@ -42,7 +42,7 @@ tspan = (0.,200_000)

const= sum
const N = 6
potential(t, x, y, z, M) = -G*(i->(j->(M[i]*M[j])/sqrt((x[i]-x[j])^2 + (y[i]-y[j])^2 + (z[i]-z[j])^2), 1:i-1), 2:N)
nprob = NBodyProblem(potential, M, pos, vel, tspan)
potential(p, t, x, y, z, M) = -G*(i->(j->(M[i]*M[j])/sqrt((x[i]-x[j])^2 + (y[i]-y[j])^2 + (z[i]-z[j])^2), 1:i-1), 2:N)
nprob = NBodyProblem(potential, M, vel, pos, tspan)
sol = solve(nprob,Yoshida6(), dt=100)
```

0 comments on commit 506d812

Please sign in to comment.