The Spectre of Math

July 12, 2013

MAA reviews, HTML versions, new sections in RA book …

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


MAA has done reviews of both of my books: see here and here.  By the way, now they have been downloaded (at least the PDF) each from over 40k distinct addresses (approximately 83k together now).  Since it seems the web version of the diffyqs book is probably more popular than the PDF, there is probably another as many people who’ve used that.

HTML version of the DiffyQs book

Speaking of the HTML version.  After last release of the diffyqs book, I’ve worked a bit on the HTML conversion.  The result is using tex4ht for conversion and then a Perl script to clean up the HTML.  This is very very hacky, but of course the main point is to make it work rather than do it cleanly.  One of the things I’ve done was to render all math at double the resolution and let the browser scale it down.  Then to make things go a bit faster I’ve made the code detect duplicate images of which there are quite a few.  I’ve also been testing with data URIs for very small images, but they don’t quite work right everywhere yet.  They would cut down on the number of requests needed per page and surely eventually I’ll do that.

The supersampling has both positive and negative effects.  Printed version of the HTML now looks a lot better.  Not totally great since I currently have things render at around 200dpi rather than perhaps 300dpi, but it’s a reasonable compromise.  Also high resolution displays give nicer rendering.  The downside is that on a regular display the equations are fuzzier due to lack of hinting.

Of course MathJax would be the ultimate answer to the math display and that’s the ultimate goal, but I can’t make it work with tex4ht reasonably nice.  I am very picky about the display being 100% correct even if uglier, over being 90% correct and pretty.  Every suggestion I’ve tried so far was very subpar on output.  I can’t make tex4ht not touch all math.  Even then MathJax does choke on a few expressions I have in the file so things would require more tweaking to make it all work.

The requirements for math display I have is 1) I want to make sure that the same font is used on all math (that’s why I render all math as images).  2) I want the output to be correct and readable (which totally disqualifies MathML since even newest versions of all browsers do terrible jobs on all but the simplest equations, and even there).  3) I want the thing to be usable on as many browsers as possible.

I think eventually the solution would be to write my own tex parser that can read the subset of latex I use for the book and output HTML pages using MathJax.  This sounds simpler than it is.  That is, getting this to work on 90% of the input is easy, then things like figures, and certain math constructions get in the way.

Another possibility is to output svg instead of png for math using dvisvgm.  This keeps the problem of fuzziness on standard displays, but is really pretty when printed or on high resolution displays .  The downside is bad support (only very new chrome and firefox support this somewhat and even they have issues, and it crashes my android phone).  I think MathJax is a better long term solution, but it will take some work and probably a move away from tex4ht.

New sections in the analysis book

Something I have not mentioned here when it happened is that the analysis book got a bunch of new sections recently (the May 29th version).  These are all extra optional sections to fill up a longer version of the course (dependencies if any are marked in the notes at the beginning of each section).  There is a section on

  • Diagonalization argument and decimal representation of real numbers (1.5)
  • More topics on series (2.5)
  • Limits at infinity and infinite limits (3.5)
  • Monotone functions and continuity (3.6)
  • Inverse function theorem in one variable (4.4)
  • The log and exp functions (5.4)
  • Improper integrals (5.5)

I am currently working on multivariable chapter(s) that would come after chapter 7.  This will take some time still, I have about half of the material in a very rough draft, having massaged bits of my Math 522 notes into something that more fits this book.  My plan is for the book to be usable for a standard one year course on real analysis.

December 19, 2012

Interesting calculation

Filed under: Mathematics,Teaching — jlebl @ 5:02 pm

An interesting back of the envelope calculation: UC Irvine is using the differential equations book as standard, that’s a couple of hundred students every quarter, and there are at least a few other places with large and small lectures using the book. A reasonable estimate at the current adoption, there are at least 1000 students every year who use the book. I recently checked on amazon how much does Boyce-DiPrima cost: the new edition is $184 (Yaikes!). It costs $110 just to rent for a semester (a used version was $165). That’s 110-184 thousand dollars a year saved by students, just because of one open book adopted in a couple of large lecture classes. Presumably, the adoption rate can only go up, so this number will go up, just from one of my books (savings from the real analysis book are going to be much smaller due to less students taking that kind of class).

Now I have nothing against the publishers, but they have their incentives wrong. Boyce-DiPrima is a fine book, but … There is really no reason to print big bulky books on expensive paper for these classes. Locally printed coursepacks or cheaply printed paperbacks are much more efficient. And the students might actually keep their books and they might help them along in other classes. Currently most students return their books as soon as they can to recover most of the cost. So if you’re teaching say a PDE class as I did this semester, you can hardly tell them to brush up on their calculus from their calculus book. They don’t have it anymore!

The incentive for me is to simply make the best book because I want to (makes me feel good, that’s I guess all I can expect). Since I make almost no money on it, I don’t really have to inflate page count just to make it more expensive, or add color and pretty pictures just for the hell of it (it would make the book quite a bit more expensive). Plus the book is more accessible. I already know students use the web version even from their phones.

So anyway, I guess I’m providing at least 2 to almost 4 times my salary in free books.

Anyway, if you do want to buy the books (and I make $2.50 on each, yay! I made almost $400 so far, it’s mostly for making me feel good rather than making money), here are the links to lulu:

Real Analysis, $13.09 + shipping

Differential equations, $16.78 + shipping

Yes, I’m a fan of arbitrary looking prices. Actually the reason for those prices is that I simply set the price so that I get $2.50 from the book, so it’s the (cost of printing)+2.50+(lulu’s cut).

December 17, 2012

New versions of books and new genius

Filed under: Hacking,Mathematics,Teaching — jlebl @ 11:47 pm

So in the last two days I’ve put up new versions of both the differential equations textbook (3 new sections, and of course some fixes) and the real analysis textbook (fixes, plus 4 new exercises). And also I’ve made a new release of genius. Actually two of those I just did today when my students were taking their final. The nice things about proctoring tests with small upper division classes is that you can get stuff done. There is no cheating going on. There’s only a few questions, so I had over two hours to burn. Next semester will be quite different. I’ll have two calculus lectures with 250+ students each. Proctoring an exam for that many students is not at all a relaxing exercise (and then there’s the grading … ugh!)

December 9, 2012

Yet another new section in DE book

Filed under: Hacking,Mathematics,Teaching — jlebl @ 7:31 am

In trying to avoid bad mood and keep stress level down, people turn to hobbies. One of my hobbies is working on my textbooks, so I have written a new section on the Dirichlet problem for the Laplace equation in the circle for the differential equations book. See the draft section. The previous section 4.9 is OK, but the solution is far more natural in the circle in polar coordinates than in a square, that is we obtain

\displaystyle  u(r,\theta) = \frac{a_0}{2} + \sum_{n=1}^\infty a_n r^n \cos(n\theta) + b_n r^n \sin(n\theta)

And then we can derive the Poisson formula which is just cool. Also it’s a good example showing more complicated change of variables since we do it in polar, and also it shows a somewhat more complicated and different separation variables.

Part of the motivation was that I did this topic in my PDE class so I had lecture notes and it really felt right for that point in the book, even to leave it as reading to interested students. The other part is that I have been improving the graphing ability of genius so I can do polar coordinates for example:


That’s the graph of the solution u(r,\theta) = r^{10} \cos(10\, \theta), showing that high frequency on the boundary means fast decay as you go closer to the center of your domain.

Though there is no UI for polar coordinates, there is just a function that allows you to plot arbitrary surface data now. Notice how it’s not graphed on a square grid, but above the disc. Also notice that internal rings have fewer points on them, that’s because I just compute fewer values at smaller radii, remember I am passing in arbitrary data, a list of tripples (x,y,z). This will be in version 1.0.16, which should come out end of next week sometime (have to let translators have a go at it). Actually the reason for doing this work on genius was not polar coordinates but showing numerical solutions in my PDE class. It’s just that one of my test cases was polar coordinates and so it just clicked and I thought: I have to write up this section, it’s just too cool to pass up and I can make the graphs now.

This brings the number of pages in the DE book to 315, and the number of exercises to 533. Yaikes! It’s become a beast. I’ll make the new version in a week or two so that it’s usuable for next semester (so if you have comments on the new section do let me know quickly).

I think now a two semester course could possibly be run out of the book. What’s going to be added in the new version is essentially about 5-6 lectures. At my speed the whole thing is now approximately 65 lectures, so a bit less than two semesters worth, but if you go just a tad slower (as many people do), do more examples, and if you factor in exams, reviews, quizzes, etc… it’s just right I think. You’ve got lots of room to spare if you want a two quarter course.

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 18, 2012

News of Microsoft demise a bit premature and study habits of college students

Filed under: Teaching,Technology — jlebl @ 3:36 pm

There are apparently a number of people all excited about Microsoft now really destroying itself. Well it still remains to be seen. But I think a good indication of where things are headed are college students. Since I have google analytics now on the textbook pagess I can do some experiments. So for example essentially all the traffic from “Irvine” is from UCI students that look at the differential equations book. So I looked at the operating systems usage from Irvine. Here are the results (note that this is a small sample, very unscientific): 72.3% Windows, 10.6% Mac, 10.4% iOS (iPad + iPhone), 3.7% Linux, 3.1% Android. Now given if you watch what people use on campus it seems mostly Mac, I think that gut feeling might be a bit skewed. On the other hand there could be computer labs running that students use and have no choice over the OS. So what conclusions could one draw? Windows is still dominant, by far. Mac is doing better, but actually quite a bit worse than one would expect among college students. Linux is doing a bit better than I would expect, it’s where Mac was just a few years ago. The interesting thing is also the iOS vs Android. It seems from the news that Android phones have beat iPhones in terms of marketshare, but here it doesn’t look like it. So that would indicate tablets are being used and iPad still beats the android tablets. Interestingly 7.3% of visitors used 320×480 resolution, and that I guess means phone. I can’t figure out how to break that down in Google Analytics. By the way, this means 7.3% are reading their textbook on their phone. This number may spike during exams :). Let’s test this theory.

I don’t know how to draw this graph for Irvine only, so it could be other places as well. But look at this graph for the number of visits from phone-like resolution:

But let’s stop that cynical thinking about cheating: There were two exams at UBC (University of British Columbia) for two classes using the differential equations book, but they were on the 14th, and the spike is on the 13th, so the students were studying hard, not cheating. Well maybe studying from a pub so they needed to look at the textbook from a phone, but still.

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.

May 9, 2012


Filed under: Mathematics,Teaching — jlebl @ 8:51 pm

I just feel like ranting about determinant notation. I always get in this mood when preparing a lecture on determinants and I look through various books for ideas on better presentation and the somewhat standard notation makes my skin crawl. Many people think it is a good idea to use

\left\lvert \begin{matrix} a & b \\ c & d \end{matrix} \right\rvert

instead of the sane, and hardly any more verbose

\det \left[ \begin{matrix} a & b \\ c & d \end{matrix} \right]     or     \det \left( \left[ \begin{matrix} a & b \\ c & d \end{matrix} \right] \right).

Now what’s the problem with the first one.

1) Unless you look carefully you might mistake the vertical lines for brackets and simply see a matrix, not its determinant.

2) vertical lines look like something positive while the determinant is negative.

3) What about 1 by 1 matrces. |a| is a determinant of [a] or is it the absolute value of a.

4) What if you want the absolute value of the determinant (something commonly done). Then if you’d write

\left\lvert\left\lvert \begin{matrix} a & b \\ c & d \end{matrix} \right\rvert\right\rvert

that looks more like the operator norm of the matrix rather than absolute value of its determinant. So in this case, even those calculus or linear algebra books that use the vertical lines will write:

\left\lvert \det \left( \left[ \begin{matrix} a & b \\ c & d \end{matrix} \right] \right) \right\rvert

So now the student might be confused because they don’t expect to see “det” used for determinant (consistency in notation is out the window).

So … if you are teaching linear algebra or writing a book on linear algebra, do the right thing: Don’t use vertical lines.

February 6, 2012

Diffy Qs notes at 20000 downloads

Filed under: Mathematics,Teaching,Technology — jlebl @ 12:31 am

So the differential equations textbook just reached 20000 downloads from unique adresses. The real analysis textbook is close behind (despite being a year younger) at around 19200. The rate is growing, it started out at around 200 per week for both in the fall and is now pushing 400 a week. As an overwhelming percentage of the hits come from google I think google might have ranked the pages higher. So if you want to help out with the project of free textbooks: link to the books on your blog, page, whatever. And press those social buttons on the page, I guess that also does it.

It’s also interesting to see how ipv6 is doing. So far, 82 ipv6 adresses looked at the real analysis book and 43 for the diffyqs. As ipv6 was active for about half a year on the server, it’s still a very tiny percentage. There were about 6-7 thousand ipv4 addresses looking at the diffyqs book during that time frame and about 8-9 thousand for the real analysis book. But at least someone is using ipv6 (if I could get an internet provider that offered ipv6, I’d use them, but I didn’t find such in Madison).

November 18, 2011

New chapter in real analysis notes

Filed under: Mathematics,Teaching — jlebl @ 11:17 pm

I finally posted a new version of the real analysis book with the new metric space chapter, it weighs in at 192 pages now (with 12pt font though). It also fixes a now record number of errata; though my standard for what is an erratum rather than just a simple obvious typo has dropped slightly. One thing that makes me feel better about errata is that it seems Rudin’s 3rd edition of principles still has some errata that is essentially the same as what I did (independently, not that I really worry about taking credit for errata:).

The differential equations book nowadays seems to be hitting fewer and fewer problems: 6 errata in the past year, 2 of which have been in new stuff added before the summer. This is despite several people using the books and one ongoing partial translation. So I guess they are rather “correct” by now.

My goal right now is to get them to be correct rather than perfect. So I haven’t really been reordering things or rewriting things that could be improved. I’ve been at most doing small improvements in exposition. The main thing is that I want to spend time doing other things too of course:)

Next Page »

The Rubric Theme Blog at


Get every new post delivered to your Inbox.