The Spectre of Math

November 27, 2012

Frobenius method and Bessel functions

Filed under: Hacking,LaTeX,Mathematics,Teaching — jlebl @ 6:57 pm

I had occasion to talk about Bessel functions and mention the Frobenius method in my PDE class and I realized that I do not have any mention of this in the book. This was the section I did not quite get to when teaching at UCSD, so it never got written. Well, worry no more. I’ve written up a draft version of the section. This will appear in the next version of the book whenever I make it, though if you do have comments, do let me know. It’s good to catch typos or make changes now.

This brings the number of pages to 307 together with new delta function section and the number of exercises to 521. Yay!

This also made me realize that Genius did not have Bessel functions implemented. They were actually easy to implement as MPFR has them done. At least for integer orders and real values anyway. Then as my current working directory of genius was such a mess with trying to include LAPACK, I decided to remove LAPACK for now from the genius git. I think what I will do is link to the fortran version at some later point. It seems like the fortran LAPACK is available almost everywhere, so it should not be a bad new dependency. Much easier than trying to make the beast compile cleanly inside genius. Anyway, so Bessel functions will be in Genius, which I think I ought to make a release of soon as there are a bunch of other small changes to set upon the world.

November 15, 2012

New section in differential equations book

Filed under: LaTeX,Mathematics,Teaching — jlebl @ 7:44 pm

I have recently finally finished a new section on the Dirac delta function for the differential equations textbook. Take a look at the draft version. Note that this is a draft, so it could have typos and could still change. If you have any comments, let me know. Especially if you want to teach with it and would like to mention some detail I don’t mention right now. I will make a new version of the book including this section sometime in December, after semester ends.

In other news, the differential equations textbook is now apparently the standard book for Math 3D at University of California at Irvine. It’s nice if people pick the book to teach out of for their class, but it’s even nicer if a department decides to standardize on the book. The real analysis book is for example the standard book at University of Pittsburgh, and they even made their own changes (adding some extra material), which is a really nice example of what can be done with free textbooks.

I also added Google Analytics to the pages so I can see where the traffic is coming from. If someone uses the books by printing out a copy for students or putting a PDF on their site, I can’t quite see it, but if they simply link to my site it’s fun to watch the traffic. As the differential equations book has an HTML version, a lot of students seem to use that rather than the PDF. I assume the PDF is just downloaded and I don’t see traffic afterwards, but when they are using the HTML version, then of course they keep hitting my site. So currently there are several classes at Irvine and two classes at University of British Columbia that simply link to my site and I get lots of traffic on the HTML version of the book. These students using the HTML version takes up a large proportion of hits to my site. If you look on the map of which cities hits are coming from, there are two big circles, one over Irvine and one over Vancouver, and then lots of other smaller circles mostly distributed all over, mostly over english speaking coutries.

I am thinking I should make an HTML version of the real analysis textbook, but it’s quite a bit of work to set things up for tex4ht, and always quite a bit of work when making a new version so I have not yet gotten around to do it. Also I am more worried about formulas coming out correctly. It would be nice to get something like mathjax working with tex4ht. Or some other solution, but I don’t want to maintain two versions so it would have to take the LaTeX source and produce the HTML perhaps with a different style file. Anyway, for now it is images for equations, which do look bad when printed, but look OK on screen.

January 13, 2011

Vim, Evince and forward and backward LaTeX synctex search

Filed under: Hacking,LaTeX — jlebl @ 11:35 pm

I was finally fed up with not having forward and backward search in vim so I hacked up the python script that was in the gedit synctex package to do what I needed. The result is evince_vim_dbus.py (GNOME 2.32 version) or evince_vim_dbus.py (GNOME 3 version old LaTeX) or evince_vim_dbus.py (GNOME 3 version that works with TexLive 2011). Copy it somewhere into your PATH (say ~/bin or /usr/local/bin). The first argument is EVINCE or GVIM. If it is EVINCE then it works just like the evince_dbus.py from the gedit synctex package. So to do forward search you add something like the following to your .vimrc file. This uses the LatexBox set of vim macros, which is pretty unobtrusive and kind of useful

function! LatexEvinceSearch()
execute "!cd " . LatexBox_GetTexRoot() . '; evince_vim_dbus.py EVINCE "`basename ' . LatexBox_GetOutputFile(). '`" ' . line('.') . ' "%:p"'
endfun
command! LatexEvinceSearch call LatexEvinceSearch()
au FileType tex map ls :silent LatexEvinceSearch

Make sure to compile your latex file with pdflatex –synctex=1 thefile. Now to jump to the right place in evince just type \ls in vim at the right spot. For vim-latex I assume something like the following would work though I have not tried so this may not actually work:

let g:Tex_ViewRule_pdf = 'evince_vim_dbus.py EVINCE'
let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_CompileRule_pdf = 'pdflatex --synctex=1 -interaction=nonstopmode $*'

Now to do inverse search, what you want to do is open up evince with the .pdf file, open gvim with the file with something like: gvim –servername foo thefile.tex. The –servername argument will let us communicate with that instance of gvim. Now run

evince_vim_dbus.py GVIM foo thefile.pdf thefile.tex

This will keep running and will talk to evince and when you control-click somewhere the script will call the “foo” instance
of gvim and tell it to go to the right line. You have to kill this script once you are done. Yeah I know this is kind of ugly, but the way synctex is done in evince is kind of moronic. The idea is I think to make the thing as complicated as possible to satisfy someone’s CS design fetish rather than to make the thing simple and easily usable (such as doing it by calling evince with the right arguments and giving evince a command to execute) … but then no script like this would be needed.

I also have a modified whaw: whaw-jiri-0.1.2.tar.gz. When you run whaw –htile you will get a different cursor, you can left click bunch of windows and then right click and whaw will put the windows side by side. The standard whaw works as well, but the –htile is usable from scripts.

Finally to put it all together I have a script that runs everything for me called buildpdftexwatch (slightly modified version of the script from my homepage) which works as follows (by the way you need zsh installed for the script). You run buildpdftexwatch thefile where thefile doesn’t have any extension. The script will open thefile.tex in gvim and thefile.pdf in evince. If you have the modified whaw it will run it with –htile (otherwise it won’t run whaw). The script watches the .tex file and whenever you save in vim it will rerun pdflatex. (it also runs pdflatex in interactive mode when first invoked before it runs evince actually). It runs pdflatex in noninteractive mode afterwards so that it doesn’t hang. It will notify you of errors by barking (that is if you have ogg123 and the default gnome sound /usr/share/sounds/gnome/default/alerts/bark.ogg installed.

This setup is not perfect. Yeah I know I should probably rewrite the shell script to work in python so that the dbus thing can be done from the script itself. However, evince also sucks so I’d rather just use xpdf, but that does not yet have synctex support. At some point I may be enough annoyed with evince that I will hack xpdf to do synctex (and do it in the simple nondbusy way that will make it easy to work with all kinds of editors). For now … this works good enough.

Update: Make sure to use the latest evince (at least 2.32.0) as older versions do not have synctex support.

Update: GNOME 3 evince breaks the dbus interface and the above python code. (So what’s the advantage of using dbus here? It is total overkill, isn’t documented well (as far as I can find), and breaks from release to release anyway). The least that evince could do is to have command line options so that one does not need to do dbus black magic to make it work. Anyway I had to fix it up and now there are two versions, one for GNOME 3 and one for GNOME 2.32. I also integrated the below comment from Simon.

Update: New braindamage coming (this time) from TexLive 2011 synctex. Apparently we must now insert /./ into the path or synctex will refuse to work. This is wrong on so many levels it is not even funny. That means there are 3 distinct versions of this code with just slightly different semantics. Somebody somewhere should get a smack over the head when a new feature that most people likely won’t ever use will break all existing usage. Certain people should not be allowed to design public facing APIs. Also there might be some change in the way vim does the current filename thing because the script was now getting full path name for the input file, so I had to fix that too. I am not quite sure what happened there though so I am not ready to blame vim. I can’t understand however how else could have the old version have worked before.

October 4, 2010

Damn Murphy!

Filed under: LaTeX,Mathematics,Teaching,Technology — jlebl @ 7:45 pm

Murphy’s law strikes again. The moment you publish something (be it a textbook or a software), you find a bug. Yesterday I put on the web new versions of both my diffyqs notes and my real analysis notes. Already yesterday I found that when I posted the real anal notes on lulu, I forgot to update the book cover to state that I’m now at UCSD. OK, that’s a minor thing, who cares.

Today I was preparing for my diffy qs class and found an error in the notes. Actually I think I spotted this error in the spring when I taught at UIUC, but somehow forgot to fix it. So I find the first significant typo in the notes the day after posting new versions of the notes. And putting up new versions of the diffy qs notes is not as trivial as it may seem. It takes about 2 hours just to build the HTML version. This is because I have tex4ht do all math as images. Doing some of the math using CSS is faster, but then you get different font for some equations (as some are done using images and some using CSS).

If jsmath actually worked right, I would use that. But since I generally have a hard time making jsmath display things correctly on my own system, I assume that it doesn’t work right for a lot of people. Also jsmath seems to break for me for the pages as large as the notes. Mathml would be the perfect solution if it would work properly and consistently on all browsers. Right now for mathml and tex4ht you have to first decide on a browser to support, which beats the whole idea.

Browser developers are generally interested in floating 3d fish rather than actually useful stuff like supporting mathml properly. One of the reasons I am sticking to firefox is because the fact that they do support mathml reasonably, and have for a while, is an indication of sanity on the part of the developers.

July 14, 2010

Microtypography

Filed under: LaTeX,Mathematics,Teaching,Technology — jlebl @ 5:38 pm

I have been playing around with the microtype package for PdfLaTeX. The results are really nice. Using the font expansion does increase the size of pdf a tiny bit, but not much. It is definitely worth it I think. Overall using the microtype package, I seem to be getting better line breaks, especially in tight places where there are floating figures (where text flows around them). To use simply add
\usepackage{microtype}
to your file, and make sure to use pdflatex rather than latex and dvipdf.

What it does is two things. Firstly it will add protruding punctuation (say periods actually hanging off sides of your paragraphs) to make a more straight looking justification. Furthermore, it may “stretch” the font by a tiny bit on certain lines to get a more even “greyness” of the text (for example, getting more uniform inter-word spacing). It also gives the justification algorithm more freedom in finding better line-breaking points, so you generally get better line-breaking (less hyphenation, etc…). It is the font stretching that adds a bit to your files since you need more copies of the font in the file, but the size increase is not terribly big on large files in relative terms. Still with microtype and PDF1.5, the 2MB differential equations pdf goes down by about 200k compared to no microtype and PDF1.4.

I want to do a bit more cleaning up and perhaps some more fixes before I post updates to the Notes on Diffy Qs, Basic Analysis, and the SCV minicourse. Probably within a few days.

Speaking of the notes, it is interesting that the real analysis notes are now downloaded more frequently by new unique IPs than the differential equations. On average about 30%-40% more. That is surprising, I would have thought that real analysis (taken almost exclusively by math majors) would be less interesting to “the masses,” rather than differential equations on the level of calculus (taken by almost any technical major).

October 27, 2009

Notes, tex4ht, adsense, literate programming

Filed under: LaTeX,Linux,Mathematics,Technology — jlebl @ 3:50 pm

I’ve spent all yesterday playing around with tex4ht. I wanted to find out how hard it is to produce PDF and web documents from one LaTeX source without sacrificing quality of the PDF. So I worked on converting the diffy qs notes into HTML. The result is
here. I don’t agree with several default decisions that tex4ht makes so it took a while to get it right. For example, tex4ht does some equations (mostly inline ones) as regular html and some as pictures. The problem is complete lack of consistency. For example the Laplace transform symbol {\mathcal L} looked different, so the student would have to figure it out. Plus the html equations are hard to read sometimes if they are complicated.

Unfortunately tex4ht is another example of literate programming effort, which is a wonderful idea which in my opinion does not work. All the literate programming projects I have seen have terrible documentation. The problem is nonlinearity of the documentation and many times circular logic. Terms are not defined before they are used, plus there is no obvious starting place. The right information is hard to find. This is a problem with all things LaTeX related. Getting started is very hard because you have no clue where to find the right info. All documents seem to assume you know everything in all the other documents and you know where to find all those other documents.

That is not to say that traditionally documented things are better. That is mostly because traditionally documented things are undocumented. And many times traditional documentation suffers from the same nonlinearity and circularity. For example, trying to implement adsense was also a pain for lack of good documentation. The documentation is a series of FAQs essentially. Each answer is vague and refers to language defined somewhere else which is not linked. And even if linked, the structure is hardly linear. There is no one place to start which defines all concepts and then goes into detail in a tree like manner. Instead the overall document is missing, and you have a spaghetti of a not simply connected graph.

On the plus side I have made $1.59 on adsense since saturday. While that may not seem like much (it is not) it is the first kind of monetary support for the notes. Actually over $1 was from the genius page which is not related to the notes and is far less visited. But apparently it has more relevant ads, or the visitors are less stingy with clicking ads. There’s about 500-1000 hits a day on the diffy qs notes webpage, though on average only 20-25 new people per day download the PDF. Still it says something about how the server is nonbusy that my notes account for about 30% of the traffic.

There have been over 3000 unique IP addresses that downloaded the notes so far. 3000 copies for a math textbook is not bad I guess. Obviously, it cannot compete with porn in the number of hits. But it seems that I am only getting cheap-o visitors. Not a single person bought the paperback even though it’s very reasonably priced. I get $2.50 from that. So thus far, adsense is getting me the equivalent of a little bit over half a copy sold. Outside of time, I have spent about $20 putting the notes together. So I guess I am still way underwater.

So … BUY THE BOOK!

September 10, 2009

More sketch fun and more textbook fun

Filed under: Hacking,LaTeX,Mathematics,Teaching,Technology — jlebl @ 10:33 pm

I have to brag. Here are some more fun sketch pics. These are probably very close to what we’ll actually put into the paper. Marketa said that the second one looks like bublanina.

more sample sketch pics

On not really related note the rate of downloads for my diffyqs notes is rising in the last week. I think I’m detecting the start of semester for many US colleges. I bet it will increase even more once the fall semester/quarter starts everywhere.

Now on related note, I’m typing up my notes for math 444 here, which is basic real analysis. So I’m writing another textbook: really baby analysis. Take baby Rudin and make it a lot less ambitious. If I were really crazy I could also take my sort of typed notes from last semester’s basic linear algebra and make those into a textbook … some other time I think, I didn’t really like the syllabus for that course, so if I were to make a textbook there it would differ more from the course here at UIUC.

September 9, 2009

Playing around with sketch 3D

Filed under: Hacking,LaTeX,Technology — jlebl @ 10:36 pm

We need figures for our latest paper. And the figures have to be of 3D things. So I’ve been playing around with sketch 3D, and so far it is working pretty well. It’s a 3D modeling language that compiles into latex.

sample figure

Cool huh?

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.