Unused Cycles

May 24, 2008

LaTeX Tests

Filed under: LaTeX — Tags: , — Kevin @ 5:11 pm

So I just imported my (few) files from Blogger.com because I was unhappy with how it handled math equations. I did some research and found out that WordPress handles them natively with \LaTeX, so I was quick to switch since I’ll probably be using mathematics quite a bit.

For example, did you know that if, for a function f of one variable,

|f(x)-f(y)| \le (x-y)^2

implies that f is actually a constant function?

The geodesic equation that test particles follow in a given metric is

\displaystyle\frac{du^\alpha}{d\tau}=\Gamma^\alpha_{\beta\gamma}u^\beta u^\gamma,

where the Christoffel symbols \Gamma^\alpha_{\beta\gamma} are given by

\displaystyle\Gamma^\alpha_{\beta\gamma}=\frac{1}{2} g^{\alpha\epsilon}\left(\frac{\partial g_{\alpha\epsilon}}{\partial x^\beta}+\frac{\partial g_{\beta\epsilon}}{\partial x^\alpha}-\frac{\partial g_{\alpha\beta}}{\partial x^\epsilon}\right).

There are a few things missing such as equation arrays, but I’ve been able to figure out how to emulate such things using arrays. For example, in a commutative ring R with elements a and b,

\begin{array}{rcl}\displaystyle(a+b)^2&\displaystyle=&\displaystyle a^2+ab+ba+b^2\vspace{0.3 cm}\\&\displaystyle=&\displaystyle a^2+2ab+b^2.\end{array}

Overall, some things are a bit annoying, but it’s definitely workable!

Codecogs images render mathematics

Filed under: LaTeX — Kevin @ 3:46 pm

So I was a little upset at how poorly Blogger.com handled math, so I did a little searching. I found a website called codecogs.com which has a LaTeX image generator. One can just direct an img tag to that website and get images such as this one:


It seems that in-line variables, such as a variable called , look fine as well.

This code is open-source, so it would be very helpful if Blogger.com would install it so that it can be used without relying on CodeCogs’ website to be up. With my luck, I’ll start using this as my sole method of rendering math and they’ll go out of business…

Interesting way to derive the area formula for a circle

Filed under: Mathematics — Kevin @ 2:19 pm

I was bored today and looking through some old notebooks of mine and came across an interesting derivation of the circle area formula using some geometry and the concept of a limit. This idea dates back to my freshman or sophomore year.

Consider an N-gon that is broken up into N identical isosceles triangles with their unique angle touching the center. Let the side that is shared by each triangle have length r. This description might be difficult to understand, so I drew the case for N=5, a pentagon.

Clearly if we let N approach infinity, we get smoother and smoother polygons until we finally get a circle, as shown in the picture below.

So, if we’d like to find the area of the N-gon, we can find the area of each triangle we’ve created and multiply by N. Using that and letting N approach infinity should give us the area of a circle.

Now the inner angle on each of these pentagons is 2\pi /N radians, which leaves each of the outer angles to be

\displaystyle\psi=\frac{\pi-2\pi/N}{2}=\pi/2-\pi/N ,

in radians. As a sanity check, as N goes to infinity here, the angle goes to \pi/2, which is expected.

Recall that the area for a triangle is a=\frac 1 2 b h , where b is the base width and h is the height of the triangle. We can find the base by the law of sines. That is:

\begin{array}{rcl}\displaystyle\frac{\sin\theta}{b}&\displaystyle=&\displaystyle\frac{\sin\psi}{r}\vspace{0.3 cm}\\\displaystyle\frac{\sin(2\pi/N)}{b}&\displaystyle=&\displaystyle\frac{\sin(\pi/2-\pi/N)}{r}\end{array}.

This gives us b, but we still don’t have h. Luckily, we can form a right triangle out of half of each isosceles triangle. This new triangle has hypotenuse r and legs h and b/2. Thus

\displaystyle \sin\psi=\frac h r.

Putting things together, we get that

\displaystyle \frac{\sin\theta}{b}=\frac h{r^2},

or after rearrangement,

\begin{array}{rcl}\displaystyle A&=&\displaystyle Na\vspace{0.3 cm}\\&\displaystyle=&\displaystyle N\frac{bh}{2}\vspace{0.3 cm}\\&=&N\left(\frac{r^2\sin\theta}{2}\right)\vspace{0.3 cm}\\&=&N\left(\frac{r^2\sin(2\pi/N)}{2}\right)\end{array}

If we now take the limit as N goes to infinity, we get an indeterminate form. We can, however, apply L’Hopital’s rule after some rearrangement:

\begin{array}{rcl}\displaystyle\lim_{N\rightarrow\infty}\frac{r^2\sin(2\pi/N)}{2N^{-1}}&=&\displaystyle\frac{r^2}{2}\lim_{N\rightarrow\infty}\frac{\cos(2\pi/N)(-2\pi N^{-2})}{-N^{-2}}\vspace{0.3 cm}\\&=&\displaystyle\frac{r^2}{2}\lim_{N\rightarrow\infty}2\pi\cos(2\pi/N)\vspace{0.3 cm}\\&\displaystyle=&\displaystyle\pi r^2\end{array}

Taking the limit gives the familiar formula.

Part of my purpose for this posting is to test out how Blogspot handles mathematical formulas. As far as I can tell, there’s no easy way to do so. I had to use an image renderer here to render the formulas, and I’m not too impressed with it. I’ll be experimenting with MathML here in the next few days to see how it renders.

Update: Fixed all of the math to go with WordPress’s built in \LaTeX capabilities. Looks pretty nice.

Blog at WordPress.com.