Posts

Coding and the Interwebs

Image
If there is one thing you should know about learning to code, it is that the internet is your friend . Learning how to find what you need on the internet is an important skill to learn. A lot of the skill comes with time, but there are a few things that can get you going. Someone has had the same problem you are having. There is an answer. Stack Overflow and Stack Exchange are miracles of the internet. Don't worry which is which unless you want to Occam's Razor - Try the simplest solution first, but avoid hackey solutions. How to ask a good question* A good format to follow for asking Google a question is language what you want to do Say I am working on some C++ code, and I want to read in columns from a file. Suppose these have multiple data types, some are strings while others are integers. Example: Alice 1 10 1e3 Bob 2 12 2e3 I would ask C++ how do I read in columns with multiple data types from a file . While this is doable, a Google search sh

On the use of Scaling Relations in Astronomy

Scaling Relations In astronomy, indeed in science, there is a dizzying array of constants, equations, and units that all need to be kept straight if we want physics to work. While it is good to know Kepler's 3rd Law for a planetary system, \[ P^2 = \frac{4 \pi^2 a^3}{G\,M_\star} \] we can also use Kepler's original form, which was a scaling relationship, \[ P^2 \sim a^3 .\] The scaling form of Kepler's law works because it is specifically for the solar system in solar system units. It says that for a planet orbiting the sun we know that \(P^2\) scales with \(a^3\). Scaling must always be done with respect to something we know or by using ratios we know. e.g. If we know two objects have some intrinsic size ratio (say two hard spheres), we can determine their relative distance by checking their observed sizes. Notice that in the scaling version of Kepler's 3rd law the various physical/mathematical constants are no longer present. Both sides of the equation are dim

Astrobites

Image
Astrobites is an astro-ph digest developed by Harvard graduates students which now has an international author roll. What is astrobites ? In their own words, Astrobites is a daily astrophysical literature journal written by graduate students in astronomy. Our goal is to present one interesting paper per day in a brief format that is accessible to undergraduate students in the physical sciences who are interested in active research. Essentially, Astrobites takes new research in astronomy and astrophysics and digests it into something approachable. With posts written by graduate students from around the globe, it provides an excellent introduction to technical writing that is understandable for the lay person, yet still scientifically interesting to the expert. Check out some of the posts by the following authors: John Johnson Ben Cook Ben Montet Elisabeth Newton (co-founder) Chris Feasi (co-founder)

Distance on the surface of a sphere

A common problem is how to measure distances on a sphere. For our normal, flat, Euclidean space, it is simply a straight line. However, this is not the case on the surface of a sphere. Do to it's curvature, the shortest path from one point to another (geodesic path) is a segment of a great circle. The derivation is short and can be found on WolframMathWorld | Great Circle . The distance is, With \(\lambda\)=longitude and \(\delta\) = latitude \[ d = R~\cos^{-1}\left[\cos{\delta_1}\cos{\delta_2}\cos{(\lambda_1-\lambda_2)}+\sin{\delta_1}\sin{\delta_2}\right], \] the angular change is \(d/R\). If you want to use pure sphereical coordinates, make the transformation \(\theta=\frac{\pi}{2}-\delta\) and \(\phi = \lambda\) If you are only interested in the motion along the lines of latitiude, then that distance is simply $$d= R|\lambda_1-\lambda_2|$$

The Double Slit with Delta function slits - A rigorous approach

Image
The truest statement about Fourier Transforms is that they are complex. - A.G.S. Two-slit interference The interference of light arises from something called Huygen's Principle. It basically states the every point a beam of light reaches becomes a source of a spherical wave. This is seen in the image below (source Wikipedia)

A Quick Look at Spherical Coordinates

Image
Because astronomy works on the Celestial Sphere, spherical coordinates play a very important role in astronomy. Most of the time we can ignore the intricacies of physics in 3-dimensions and work in a 2D far-field regime. (The far-field regime is just fancy speak for "small-angles"). However, it can be useful to understand why spherical coordinates are they way they are. Here, we will quickly derive the spherical differential volume element. Differential, just means vanishingly small. To let the cat out of the bag, the spherical differential volume element is, \[ dV = r^2 \sin{\theta}\, dr\, d\theta \, d\phi .\] The figure above shows the coordinate system we will be working with. This form is commonly used in astronomy, and also in some physics. However, it is different from the way mathematicians define it. In mathematics the \(\theta\) and the \(\phi\) are often switched. The astronomy convention is the more commonly used one in physics and astronomy (sorry mathematica

MathJax on Blogger

Image
Typesetting mathematics in HTML is time-consuming to say the least. The LaTeX language math-mode allows us to typeset math in a much simpler way. Our interface to this system is MathJax. Setting up MathJax on Blogger can be a daunting task. While there are many ways to implement MathJax on the internet. You will want to put the following code into the Blogger template you choose to use. Paste the code right below the head tag in the template. To do this go to the Template Editor and edit the HTML ( Template >> Edit HTML ) The simplest method is to just use the paste the following code into the template: <script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script> After pasting, make sure none of the text or symbols have changed. If it is not working, sometimes it is a good idea to paste it into a plain-text text editor (like EditPad ). The config=Tex-AMS-MML-HTMLorMML tell