Jan 23 2012

Small tip for Hebrew LyX users – Stop the Gibberish

Are you using LyX with Hebrew?

Isn’t it annoying that when CAPSLOCK is on the entire text goes Gibberish?

The problem lays in the fact that by default some of the capital letters are mapped to the hebrew Niqqud characters. There for, when you type ‘S’ for example you will get a Dagesh.

How to solve it? Just edit: “C:\Program Files\LyX20\Resources\kbd\hebrew.kmap” (replace “C:\Program Files\LyX20\” with your installation folder) and comment all the lines (using # as comment) below the line:

# Hebrew points (nikud)

Restart LyX and we are done!


Jan 18 2012

Gaussian Integral

[latexpage]

A Gaussian function (named after one of the greatest mathematician, Carl Friedrich Gauss) is a function of the form: \[ f\left(x\right)=ae^{-\frac{\left(x-b\right)^{2}}{2c^{2}}} \]

We would have like to examine the following integral: \[ I=\intop_{-\infty}^{\infty}e^{-x^{2}}\mathrm{d} x\]

But we are facing a problem, what is the antiderivative function of $e^{-x^{2}}$?

Well, You won’t be able to find one, at least not an elementary one. The integral of a Gaussian is the Gauss error function, but in this special case, there is a cool way to calculate this integral.

At first, Instead of looking at $I$, lets take a look at $I^{2}$. Meaning:
\[ I^{2}=\intop_{-\infty}^{\infty}e^{-x^{2}}\mathrm{d} x\intop_{-\infty}^{\infty}e^{-y^{2}}\mathrm{d} y \]

Note: In the second integral, I’ve changed the variable of integration to y. I can do that, because it’s a completely separated integral.

Now, notice that the following integral is equivalent to the following:\[
\intop_{-\infty}^{\infty}\intop_{-\infty}^{\infty}e^{-x^{2}-y^{2}}\mathrm{d} x\mathrm{d} y
\]
Well, That’s a bit weird. Now we have a double integral! We’ve made the problem much more complex! Or did we?

Well, yes, now we have a double integral, but there is a good reason for that. Now we can change our coordinate system to the polar coordinate system (Meaning: $x=r\cos\theta, y=r\sin\theta$) and remember to multiply by the Jacobian determinant! In our case, the Jacobian determinant is $r$. So, we got:
\[ \intop_{0}^{2\pi}\intop_{0}^{\infty}e^{-r^{2}}r\mathrm{d}r\mathrm{d}\theta \]
But wait a minute, this looks familiar! Notice that:
\[ =-\frac{1}{2}\intop_{0}^{2\pi}\intop_{0}^{\infty}\frac{\mathrm{d}}{\mathrm{d}r}\left(e^{-r^{2}}\right)\mathrm{d}r\mathrm{d}\theta=-\frac{1}{2}2\pi\intop_{0}^{\infty}\frac{\mathrm{d}}{\mathrm{d}r}\left(e^{-r^{2}}\right)\mathrm{d}r=\] \[ =- \pi \left[e^{-r^{2}}\right]_{0}^{\infty}= -\pi\left[0-1\right]=\pi\]
Therefore:
\[ I^{2}=\pi\Rightarrow I=\intop_{-\infty}^{\infty}e^{-x^{2}}\mathrm{d} x = \sqrt{\pi} \]


Dec 23 2011

Bug in LyX for Mac – \Omega, \otimes are not being displayed on designer

If you are using LyX on mac you probably noticed that some symbols are missing while editing an equation.

One of the symbols missing is $latex \Omega$ which is really annoying when you learn probability.
When you try and type \Omega, instead of seeing the symbol you will just see a blank space.

I’ve dived into the code, and found out how the all designer works. For most of the symbols, the translation is quite simple. There are several font files, and a file named symbols (located in /Application/LyX.app/Contents/Resources) which maps every latex code to the relevant font and unicode value.

The problem with $latex \Omega$ and $latex \otimes$ is that their unicode value is 0x00ad. And as it seems, QT4 has bug with characters with that code. LyX source code mentioned this bug in GuiPainter.cpp and it have some code to try and fix it, but for some reason it doesn’t work.

A work around for the $latex \Omega$ is to make a small change in the symbols file, locate the Omega line (with capital O) and change the code from 173 to 937 (a code for different Omega character that is available in the font).

I didn’t find (didn’t really looked for) a way to fix the \otimes, because i don’t really use it. A way to fix it will be using a font editor and changing the font and map the wanted symbols from other unused code. Again, didn’t care enough to do it, If someone want me to just post here. But I believe that LyX developers will soon enough fix it.