I (reluctantly?) agree with Britton that there's an error.  He's going to fix it, unless somebody speaks now.  (Else, holding peace forever is expected.)<br><br><div class="gmail_quote"><span style="font-size: large; font-weight: bold;">Forwarded conversation</span><br>
Subject: <b class="gmail_sendername">yt: embarrassing question, gravity</b><br>------------------------<br><br><span class="undefined"><font color="#000000">From: <b class="undefined">david collins</b> <span dir="ltr"><<a href="mailto:antpuncher@gmail.com">antpuncher@gmail.com</a>></span><br>
Date: Sat, Jan 17, 2009 at 5:28 PM<br>To: Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>><br></font><br></span><br>Hey, Matthew--<br>
<br>
I have an embarrassingly dumb question that I'm not going to see until<br>
I ask someone. And I swear it made sense to me once.<br>
<br>
In your _IsBound function, you have<br>
pot = 2*G*PointCombine = 2 * G * Sum_i{ Sum_j { m_i * m_j / || r_i - r_j || }}<br>
<br>
Why the 2 in front?   Why isn't there a 1/2 for double counting in the<br>
sum?  And isn't the virial thm 2*KE < PE?  So Now I'm missing an extra<br>
2, so I'm off by 8.<br>
<br>
Thanks,<br>
<font color="#888888">d.<br>
</font><br>----------<br><span class="undefined"><font color="#000000">From: <b class="undefined">Matthew Turk</b> <span dir="ltr"><<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>></span><br>Date: Sat, Jan 17, 2009 at 5:40 PM<br>
To: Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>><br></font><br></span><br><div bgcolor="#FFFFFF"><div><br><br><br></div><div><br>Begin forwarded message:<br><br></div><blockquote type="cite">
<div><b>From:</b> "david collins" <<a href="mailto:antpuncher@gmail.com" target="_blank">antpuncher@gmail.com</a>><br><b>Date:</b> January 17, 2009 5:28:31 PM PST<br><b>To:</b> "Matthew Turk" <<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>><br>
<b>Subject:</b> <b>yt: embarrassing question, gravity</b><br><br></div></blockquote><div><div></div></div></div><br>----------<br><span class="undefined"><font color="#000000">From: <b class="undefined">Matthew Turk</b> <span dir="ltr"><<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>></span><br>
Date: Sat, Jan 17, 2009 at 5:45 PM<br>To: david collins <<a href="mailto:antpuncher@gmail.com">antpuncher@gmail.com</a>><br>Cc: Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>><br>
</font><br></span><br>Hey,<br>
<br>
Britton wrote it so I fwd'd it to him. We don't double count, tho - iteration is n < m inside PointCombine.c. Hopefully Britton can point out more?<br>
<br>
-Matt<div><div></div></div><br>----------<br><span class="undefined"><font color="#000000">From: <b class="undefined">david collins</b> <span dir="ltr"><<a href="mailto:antpuncher@gmail.com">antpuncher@gmail.com</a>></span><br>
Date: Sat, Jan 17, 2009 at 5:49 PM<br>To: Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>><br></font><br></span><br>> iteration is n < m inside PointCombine.c.]<br>
<br>
Todja it was dumb-- I fail both reading and programming on that one...  XD<br>
<font color="#888888"><br>
d.<br>
</font><div><div></div></div><br>----------<br><span class="undefined"><font color="#000000">From: <b class="undefined">Britton Smith</b> <span dir="ltr"><<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>></span><br>
Date: Sat, Jan 17, 2009 at 6:39 PM<br>To: Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>><br>Cc: david collins <<a href="mailto:antpuncher@gmail.com">antpuncher@gmail.com</a>><br>
</font><br></span><br>After looking at this again, I think the first 2, as in 2 * G * <span>Sum_i{ Sum_j { m_i * m_j / || r_i - r_j || }}, may be an error.  As Matt said, the sum is actually i = 0 ... N-1 and j = i+1...N</span>, so there is no need for an additional 0.5.  When I had done this originally, I was somewhat uncertain about calculating the boundness of N particles as to whether you should do the full sum or this partial sum mentioned above.  I had found the source to some other code that calculates gravitational potential for particles and it had this partial sum with a 2 out front, so I went with that.  That, I'm pretty sure now, it not right.  The total binding energy is actually the sum over all N * (N - 1) / 2 pairs of cells or particles, which is exactly the sum above without that 2.<br>

<br>My impression of the virial theorem is that it applies to the time average of KE and PE.  Any body in a stable orbit will satisfy the virial theorem when averaged over the entire orbit.  A perfectly circular orbit has 2*KE = PE all the time, but an elliptical orbit will vary in both directions throughout its orbit.  So, gravitational boundness for an object requires that KE < PE at all times, but when you do a time average of that object you will find 2 <KE> = <PE>.<br>

<br>In conclusion, there should be no problem with respect to the virial theorem, but the first 2 in front of the sum should probably be removed.  If you guys agree with this, I will go ahead and remove that 2 from the calculation.  Let me know what you guys think.<br>

<br>Thanks for pointing this out, Dave.<br><font color="#888888"><br>Britton</font><div><div></div></div><br></div><br>