I am trying to program a $n$-body problem simulation. To calculate the position and velocity after a time-step I want to split it in multiple 2 body problems. Now I am stuck, trying to find the velocity and position of two bodies (ignoring all the others) after one time-step with given mass, start position and velocity.  I am able to calculate the force between the two, but I am unable to solve the differential equation $$ \ddot{\vec{r_{12}}(t)} = G M \frac{\vec{r_{12}(t)}}{|\vec{r_{12}(t)}|^3} \\ M := m_1 + m_2 \\ \vec{r_{12}(t)} := \vec{r_1}(t) - \vec{r_2}(t) $$  to calculate the position relative to each other. What is $\vec{r}(t)$ and how can I calculate it? And is there another and maybe faster way to get the positions and velocities?  Edit: As @Sofia pointed out, this was not clear: $\vec{r_1}$ and $\vec{r_2}$ are the location vectors of the two masses.
Two particles with initial positions and velocities $r_1,v_1$ and $r_2,v_2$ are interacting by the inverse square law (with G=1), so that  $$ {d^2r_1\over dt^2} = - { m_2(r_1-r_2)\over |r_1-r_2|^3} $$ $$ {d^2r_2\over dt^2} = - { m_1(r_2-r_1)\over |r_1-r_2|^3} $$  (the inverse square law along the line of separation). What is the complete solution of these differential equations? What is the position of the two objects as a function of time?  After reading a lot on Wikipedia, I've come to the definition of center of mass and relative coordinates:   $$R(t) ~=~ \frac{m_1 r_1 + m_2 r_2}{m_1+m_2}$$  $$\ddot{r}(t) r(t)^2 ~=~ (m_1+m_2)G$$  Where $R$ is the center of mass, and $r$ is the displacement between the particles... Is this correct? How do I proceed to solve the differential equation?
Neg Binomial and the Jeffreys' Prior I'm trying to obtain the Jeffreys' prior for a negative binomial distribution. I can't see where I go wrong, so if someone could help point that out that would be appreciated.  Okay, so the situation is this: I am to compare the prior distributions obtained using a binomial and a negative binomial, where (in both cases) there are $n$ trials and $m$ successes. I get the right answer for the binomial case, but not for the negative binomial.   Let's call the Jeffreys' prior $\pi_J(\theta)$. Then,  $$ \pi_J(\theta)\propto [I(\theta)]^{1/2}. $$  Under the regularity conditions (fulfilled as we are dealing with the exponential family),  $$ I(\theta)=-E\left(\frac{\partial^2 \log L(\theta|x)}{\partial \theta^2}\right) $$ where for the negative binomial $n$ is $x$ in the above expression (the total number of successes $m$ is fixed, $n$ is not). The distribution --I think-- is  $$ p(m|\theta)\propto\theta^m(1-\theta)^{n-m} $$ since $\theta$ is defined as the probability of success and $m$ is the number of successes. This is also the likelihood, since $m$ is a scalar and not a vector. Hence,  $$ L(\theta|n)\propto\theta^m(1-\theta)^{n-m}\\ \log L(\theta|n)=m\log\theta +(n-m)\log (1-\theta)\\ \frac{\partial\log L(\theta|n)}{\partial \theta}=\frac{m}{\theta}-\frac{n-m}{1-\theta}\\ \frac{\partial^2\log L(\theta|n)}{\partial \theta^2}=-\frac{m}{\theta^2}-\frac{n-m}{(1-\theta)^2} $$ so the Fisher information is  $$ I(\theta)=-E\left(\frac{\partial^2\log L(\theta|n)}{\partial \theta^2}\right)=\frac{m}{\theta^2}+\frac{E(n)-m}{(1-\theta)^2}=\frac{m}{\theta^2}+\frac{\frac{m\theta}{1-\theta}-m}{(1-\theta)^2}\\ =\frac{m(1-\theta)^2+\frac{m\theta^3}{(1-\theta)}-m\theta^2}{\theta^2(1-\theta)^2}=\frac{m(1-2\theta)+\frac{m\theta^3}{(1-\theta)}}{\theta^2(1-\theta)^2}\\ =\frac{m(1-2\theta)(1-\theta)+m\theta^3}{\theta^2(1-\theta)^3}=\frac{m(1-3\theta+2\theta^2+\theta^3)}{\theta^2(1-\theta)^3}\\ \propto\frac{1-3\theta+2\theta^2+\theta^3}{\theta^2(1-\theta)^3} $$  This, however, does not give me the correct answer. The correct answer is  $$ \pi_J(\theta)\propto \frac{1}{\theta(1-\theta)^{1/2}} $$ which means that the Information I get should be   $$ I(\theta)=\frac{1}{\theta^2(1-\theta)} $$ since the prior should be proportional to the square root of the information.   Can anyone find any mistakes? I wouldn't be surprised if I screwed something up with the set up of the distribution (successes vs failures with their respective probabilities, etc).   I used the expected value from  and I know the correct answer from . Sequence of rationals with an irrational limit have denominators going to infinity Managing error with GPS routes (theoretical framework?) I'm looking for the appropriate theoretical framework or speciality to help me deal with understanding how to deal with the errors that the GPS system has - especially when dealing with routes.  Fundamentally, I'm looking for the requirements on the data and any algorithms to use to be able to establish the length of a trail. The answer needs to be trustworthy.  A friend of mine was the race director of a race which was billed as 160km but the Garmin watches everybody has makes it more like 190km+. It caused quite some grief at the finish line, let me tell you!  So my friend went back to the course with various GPS devices in order to remap it and the results are interesting.  Using a handheld Garmin Oregon 300 she got 33.7km for one leg. For the same leg on a wrist watch Garmin Forerunner 310xt it came out to 38.3km.  When I got the data from the Oregon it was obvious that it was only recording data every 90 seconds or so. The Forerunner does it every couple of seconds.  When I plotted the data from the Oregon I could see that it got confused by some switchbacks and put a line straight through them and a curve was made a little less.  However, I muse that the difference in the recording frequency is much of the explanation. i.e. by recording every couple of seconds the Forerunner is closer to the real route. However, there will be an amount of error because of the way GPS works. If the points recorded are spread around the real route randomly (because of the error) then the total distance will be larger than the real route. (A wiggle line going either side of a straight line is longer than the straight line).  So, my questions: 1. Are there any techniques I can use on a single dataset to reduce the error in a valid way? 2. Does my theory about the difference in recording frequency hold water? 3. If I have multiple recordings of the same routes are there any valid techniques to combine them to get closer to the real route?  As I say, I don't really know what to search for to find any useful science about this. I'm looking for ways to establish just how long a given piece of trail is and it is very important to people. An extra 30km in a race is an extra 5+ hours we weren't expecting.  As requested here is some sample data:       Thanks for any advice you can give. The rulebook states that carrying capacity is the strength score times 15 (lbs). Find familiar allows me to get a hawk, which has a strength score of 5. This results in a carrying capacity of 75 lbs. This is well within the range of weights for small people such as gnomes or halflings. Does this mean my familiar can carry them and fly away (given they do not struggle)? For some reason my iMac keeps turning off around 5 to 10 minutes into boot.  Also just recently it turns on but has shaded lines going down the screen. I have not installed any weird programs and i have not used it in around 3 months.   Any ideas on what the issue is, i don't have any other information about the issue besides whats happening when i use it.  The image i'm showing you was found on google but this looks exactly like mine does.  The model of my imac is the late 2011 model. tar unpack : Unexpected EOF in archive I have downloaded eclipse-platform-3.7-linux-gtk-x86_64.tar.gz.  Using Ubuntu 10.10  64-bit on Intel 64-bit processor.  While trying to unpack the contents (either double-click or right-click &amp; open-with-archive-manager) I get this error:  gzip: stdin: unexpected end of file&lt;br/&gt; tar: Unexpected EOF in archive&lt;br/&gt;  tar: Error is not recoverable: exiting now   Is there any remedy to repair it? or is the downloaded file corrupt &amp; needs to be re-downloaded? Inspired by this ....  I am the sole person using my system with 12.04. Every time I issue a sudo command; the system asks for the user password (which is good in its own way).  However I was thinking; without activating the root account; how can I execute the sudo commands which will not ask for user password to authenticate.  NOTE: I want to execute sudo command without authenticating via password; only when they are executed via terminal. I don't want to remove this extra layer of security from other functions such a while using 'Ubuntu software center' or executing a bash script by drag-drop something.sh file to the terminal. Why use pointers? Integrating a function of tan inverse How would I carry out the following integration? $$\int_0^12\arctan x^2$$  I tried to substitute $x^2 = \tan\theta$ From there I wrote the integral as: $$\int_0^{\pi/4}\theta\cdot \frac{\sec^2\theta}{\sqrt{\tan\theta}}\ d\theta$$  Now, is my only option to use integration by parts? Or is there a better method to solve this integral? conversion of laplacian from cartesian to spherical coordinates I am currently working through the problems in , with the goal of hopefully understanding how magnets work. At the moment I am a little stuck on one of the early problems in the first chapter. And I would like a Hint about how to proceed. The problem is to solve the time derivative of the expectation value of momentum of a particle. ie: $$ \frac{d\left&lt;p\right&gt;}{dt}. $$ My working so far Just prior to that question the text gives an expression for momentum, $$\int\limits_{-\infty}^{+\infty}{\Psi^*\left[-i\hbar \frac{\partial}{\partial x}\right]\Psi}dx, $$ (Where $\Psi$ is a function satisfying Schrödinger's equation, $i$ is the square root of negative 1, and $\hbar$ is Planck's constant divided by $2\pi$.) So my initial approach was to try and differentiate this with respect to $t$. $$ \frac{d}{dt}\int\limits_{-\infty}^{+\infty}{\Psi^*\left[-i\hbar \frac{\partial}{\partial x}\right]\Psi}dx. $$ However I didn't know how to do that, so I asked around in the maths chatroom, and got a lot of help. Specifically  from @RobJohn: $$ \begin{align} \int vv'\,\mathrm{d}x &amp;=vv-\int vv'\,\mathrm{d}x\\ &amp;=\frac12vv+C \end{align} $$ So I suppose it would follow that, $$ \begin{align} \int\limits_{-\infty}^{+\infty}{         \left(             \Psi^*                 \left[                     \frac{\partial}{\partial x}                 \right]             \Psi         \right)         }\,\mathrm{d}x &amp;=  \left[\Psi^* \cdot \Psi\right]_{-\infty}^{+\infty} - \int\limits_{-\infty}^{+\infty} {\Psi\frac{\partial \Psi^*}{\partial x} }\,\mathrm{d}x\\ &amp;= \frac{1}{2}|\Psi|^2 \Big|_{-\infty}^{+\infty}, \end{align} $$ And then, $$ \begin{align} &amp;\frac{d}{dt}\int\limits_{-\infty}^{+\infty}{\Psi^*\left[-i\hbar \frac{\partial}{\partial x}\right]\Psi}dx \\&amp;=-i\hbar \frac{d}{dt}\left( \frac{1}{2}|\Psi|^2 \Big|_{-\infty}^{+\infty} \right). \end{align} $$ But this feels wrong. I'm not sure exactly why. (Maybe it's just because it is the limits of my maths)  For reference, regarding what I understand, my maths is pretty low-level, I took a course in undergrad calculus over 10 years ago and only just passed that at the time, and my physics knowledge is not much further than that of an enthusiastic lay person. I am familiar with what partitions are, but I saw , and realised I didn't know what "aligned partitions" are.  So what does it mean to "align" partitions? What are the benefits, and the downsides? Verify proof that sequence converges Run a command without making me wait When running umount /path I get:  umount: /path: device is busy.   The filesystem is huge, so lsof +D /path is not a realistic option.  lsof /path, lsof +f -- /path, and fuser /path all return nothing. fuser -v /path gives:                    USER        PID ACCESS COMMAND /path:            root     kernel mount /path   which is normal for all unused mounted file systems.  umount -l and umount -f is not good enough for my situation.  How do I figure out why the kernel thinks this filesystem is busy? Why does "touch -a" also set the ctime? Is it touch(1) from coreutils-8.4-37.el6.x86_64 or my brain which is broken?  $ touch abc $ LANG=C stat abc   File: `abc'   Size: 0               Blocks: 0          IO Block: 4096   regular empty file Device: fd04h/64772d    Inode: 10485773    Links: 1 Access: (0664/-rw-rw-r--)  Uid: (3060399/ nodakai)   Gid: (  418/   quant) Access: 2016-10-14 18:42:06.189751847 +0800 Modify: 2016-10-14 18:42:06.189751847 +0800 Change: 2016-10-14 18:42:06.189751847 +0800 $ touch -a abc $ LANG=C stat abc   File: `abc'   Size: 0               Blocks: 0          IO Block: 4096   regular empty file Device: fd04h/64772d    Inode: 10485773    Links: 1 Access: (0664/-rw-rw-r--)  Uid: (3060399/ nodakai)   Gid: (  418/   quant) Access: 2016-10-14 18:42:17.374235446 +0800 Modify: 2016-10-14 18:42:06.189751847 +0800 Change: 2016-10-14 18:42:17.374235446 +0800 $ touch --help | grep 'access time'   -a                     change only the access time   As you see, it was not only atime but also ctime which was updated by touch -a !?!?  The filesystem is ext4 over LVM if that makes any differences. Can't get Freeglut to work with Haskell on Windows What happens when a Wizard loses Intelligence after preparing his spells? A Wizard prepares a number of spells equal to his Wizard level + his Intelligence modifier.  But what happens if he loses Intelligence (the most obvious way I can think of is unattuning to a Headband of intellect and having a base Intelligence score of less than 18) after preparing his spells? Does he...   Lose access to the first [INT mod lost] spells he prepared? Lose access to the last [INT mod lost] spells he prepared? Randomly lose access to [INT mod lost] of the spells he prepared? Keep access to all his prepared spells (but will be able to prepare fewer spells after his next long rest, unless he regains the lost intelligence)? Where are all islands and discoverable locations? After taking off in Simpleplanes and flying around over the ocean for a while, I've found a lots of tiny islands all over the place, and a few really big ones that unlock new spawn locations once found.  Large islands appear to also have many discoverable 'locations' around them as well, like airports, carriers, or landmarks.  These locations automatically become available as start points once discovered.  Where can I find all of these major islands, and once there, where should I look to unlock all of the locations? Can I use the Twig template engine? I do a lot of  development and I like their templating language. , the , looks very much like it.  How can I use Twig in Drupal 7 or even Drupal 6?