Math on the Pololu website!

Posted by Paul on 27 June 2014

Tomorrow is Tau Day! To celebrate, I thought I should write something about how we use math on our website.

Mathematics is essential to engineering, so we often need to use math when presenting a product or discussing some point about robotics and electronics. In the past, we have struggled to come up with our own ways of getting math online, such as using HTML code (e.g. a 1×2 table with an internal border can look like a fraction) or finding some engineer here who knows how to type up equations in LaTeX and export images.

Over the past month, we have quietly switched to MathJax, which is the technology used on the very popular site MathOverflow. We are using MathJax, for example, to explain current and voltage settings for our new TPS2113A carrier and to show how to compute the exact gear ratios of some of our Micro Metal Gearmotors – the 1000:1 Micro Metal Gearmotor being a particularly good example since it has so many gears.

MathJax allows us to type math directly into web pages using simple text codes, and it uses modern features of your web browser to format the math for you as the page is loaded. If you reload this page and watch the equation below carefully, you will briefly see the raw code before MathJax redraws it:

int_0^oo e^(-x^2) dx = sqrt pi / 2

(The integral of a Gaussian has long been one of my favorite mathematical exercises.)

Try it yourself

Instead of using the LaTeX syntax used on MathOverflow, we chose a simpler input format called ASCIIMath. You can read documentation on the ASCIIMathML page. The way it works is that you type ASCIIMath code within double back-quotes, like this:

int_0^oo e^(-x^2) dx = sqrt pi / 2

We have enabled MathJax throughout the site, including blog comments, so that you can participate fully in discussions here, starting with this little Tau Day celebration. So, what is your favorite equation? Try out MathJax and share it with us in the comment section below!

Ben wanted me to post the details of the Gaussian integral, so here we go.

It's simpler to think about the full integral from -oo to +oo. Let's give that a name:

lambda = int_-oo^oo e^(-x^2) dx.

Then, instead of trying to compute lambda, we work on lambda^2:

lambda^2 = ( int_-oo^oo e^(-x^2) dx )^2 = int_-oo^oo int_-oo^oo e^(-x^2) e^(-y^2) dx dy.

We note that e^(-x^2) e^(-y^2) = e^(-(x^2+y^2)) and rewrite in polar coordinates:

lambda^2 = int_0^oo e^(-r^2) 2pi r \ dr.

Luckily, that integral is easy, since d / (dr) pi e^(-r^2) = - 2 pi r \ e^(-r^2):

lambda^2 = - [ pi e^(-r^2) ]_0^oo = pi;

lambda = sqrt(pi).

Finally, since the Gaussian is an even function, our desired integral is just half of that value:

int_0^oo e^(-x^2) dx = sqrt pi / 2.
Einstein Field Equation:
G_(mu nu) + Lambda g_(mu nu) = (8 pi G)/c^4 T_(mu nu)