Older blog entries for vicious (starting at number 326)

Frobenius method and Bessel functions

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.

Syndicated 2012-11-27 18:57:39 from The Spectre of Math

“Maxima is calculating”

So friday afternoon I wanted to test for existence of a certain mapping that takes one surface to another surface. Everything is algebraic so one might assume if a mapping exist it might actually be polynomial and since everything is of low degree, the mapping might be as well. So I just set up brute force equations and tried an arbitrary degree 2 mapping. After a second or two, maxima returned no solutions to the resulting system. OK, so how about plugging in degree 3. It turns out I don’t need to test the linear terms, and there are 3 variables so 16 variables per component so I get an algebraic system in 48 variables. Sounds bad, but lot of the equations become something of the form “x=0″. So I looked at a subset of the system. Already the generating of the equations took a few seconds. So I thought, this will take a few minutes. So I started “algsys” on the equations. Well, that was wednesday afternoon. It is Sunday and the thing is still running. Unfortunately it just says “Maxima is calculating” in the wxMaxima window, so one has no clue if it will take another day or so, another year or so, or if the sun will implode first. I sort of have the feeling it is doing something stupid. Once I get more time for math on monday, I’ll probably try to simplify the equations by hand first. I could also try for the solution (or lack thereof) numerically. In the meantime I’ll let it run. This is on my laptop which is surely not meant as a computation machine. It’s only running on one core so it’s not heating up too badly. When I was running some computations for days in the summer on all four cores you could almost cook eggs on the keyboard.

On a related front, I decided that my work computer is sitting too idly so I started the degree 19 calculation that we never did with Danny on our paper [1]. In 2008 we thought it would take at least half a year. Presumably the computers have gotten a tad quicker in the meantime (and since I’m running it on 4 cores), so perhaps the result will come in sooner. Still the progress seems slow from the output so far. It is a bit difficult to judge, I’ll try to estimate time left more precisely later on, but just as first guess from looking at the output I don’t think this will be done before christmas.

There is something magical about pressing ENTER to start the computation you know will take months to complete. It is one of the few places where you really use the fact that you have a fast computer. Most computer power is totally wasted. So for example in somewhat similar time frame Firefox managed to get 70 minutes of CPU time (maxima is up to 5208 now). Now that’s with only very occasional short browsing over the last few days. It seems mostly it’s the tabs being open that eat up time, run the CPU and heat our house. Come to think of that my office will be quite warm I bet once I get there on monday, I don’t think the heating runs on the room termostat, as the swich on that thing is in “off” position and it still heats the room. So with the added heating from 4 cores running at top speed and it being a small room, it should get toasty.

[1] Jiří Lebl and Daniel Lichtblau, Uniqueness of certain polynomials constant on a line, Linear Algebra and its Applications, 433 (2010), no. 4, 824-837, arXiv:0808.0284.

Syndicated 2012-11-25 15:57:59 from The Spectre of Math

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

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.

Syndicated 2012-11-18 15:36:25 from The Spectre of Math

New section in differential equations book

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.

Syndicated 2012-11-15 19:44:27 from The Spectre of Math

Numerical range

I was fiddling with numerical range of two by two matrices so I modified my root testing python program to do this. The numerical range of A is the set of all values

\frac{v^* A v}{v^* v}

for all nonzero vectors v. This set is a compact set (it can be seen as the image of the mapping $latex v^* A v of vectors on the unit sphere v^* v = 1 which is a compact set). It’s convex which is harder to show. For two by two it is an elliptic disc (could be degenerate).

See the result here, it plugs in random vectors and shows the result. Here’s an example plot for the matrix A=\begin{bmatrix} 1 & i \\ 1 & -1 \end{bmatrix}.

Numerical range of 2x2 matrix

The code is really inefficient and eats up all your cpu. There’s no effort to optimize this.

Syndicated 2012-11-09 00:06:40 from The Spectre of Math

Economy and elections

I have a theory as to why did the economy improve over this summer and into the fall, which led to Obama winning the election. I bet a part of this was the money spent on the campaigns. That was 2 billion dollars that went to very targeted places like Ohio. No wonder economy in Ohio is doing quite well. If it weren’t for the election, Sheldon Adelson would not spend 100 million on random stuff over the period, he would sit on the money. This way he spent it to elect Romney improving the economy in battlegound states which led to Obama winning.

Yes it is a bit of a stretch, but it should not be totally dismissed. Apparently the campaigns spent approximately 190 million just in Ohio [1]. That means that GDP of Ohio went up by 0.04 percent just because of the election (the GDP is 477 billion [2]). That’s not much but it’s not negligible. Also note that it wasn’t spread out over the whole year it was rather concentrated. Further note that state spending is 26 billion [2], so this is 0.73 percent of what the state spends in a given year. If the state gets say 5 percent of that money in various taxes (just pulling a number out of a hat; a reasonable estimate in my layman opinion based on state budget versus GDP) that would mean approximately 10 million extra tax revenue for the state. Not at all bad.

So, Sheldon Adelson was really rooting for Obama! Sneaky way to do it too.

[1] http://www.nationaljournal.com/hotline/ad-spending-in-presidential-battleground-states-20120620
[2] http://en.wikipedia.org/wiki/Economy_of_Ohio

Syndicated 2012-11-08 18:55:26 from The Spectre of Math

Linus has way too much time on his hands

So latest news comes that Linus has switched to KDE. This apparently after first switching to XFCE, then I guess back to GNOME. Hmmm.

I’m still on XFCE. Can’t be bothered to try anything else. Yes XFCE is somewhat sucky, but once you fix its stupidities (such as the filemanager taking a minute to start up due to some vfs snafu that’s been apparently around forever), it’s there. I’ve entertained the thought of trying something else, but it’s not an exciting enough proposition.

Now I am wondering what to do once Fedora 16 stops being supported. Should I spend the afternoon upgrading to 18? The issue is that I can’t do the normal upgrade thing since that would boot into it’s own environment and would not load a necessary module that I do on startup that turns off the bad nvidia card with a screwed up heatsink. It’s impossible to do this in BIOS (stupid stupid Lenovo, never buying another Lenovo again). Anyway, that means having to do it right after boot, but before the GUI comes up since that would (even if using the intel card) turn the laptop into a portable oven, and it will just turn off and die nowdays. I am thinking that maybe if the upgrade happens during the wintertime, I could just stick the laptop on snow (and wait till it’s at least 20 below freezing) and then it could stay sane for the duration of the upgrade perhaps. I will probably try to do the upgrade by yum only, but that seems like it could be bug prone and would require some manual tinkering, and I just don’t care enough to do that.

Next time picking a distro I’m going with something LTS I think. And … Get off my lawn!!!

Syndicated 2012-11-03 20:44:28 from The Spectre of Math

Visualizing complex singularities

I needed a way to visualize which t get hit for a polynomial such as t^2+zt+z=0 when z ranges in a simple set such as a square or a circle. That is, really this is a generically two-valued function above the z plane. Of course we can’t just graph it since we don’t have 4 real dimensions (I want t and z to of course be complex). For each complex z, there are generically two complex t above it.

So instead of looking for existing solutions (boring, surely there is a much more refined tool out there) I decided it is the perfect time to learn a bit of Python and checkout how it does math. Surprisingly well it turns out. Look at the code yourself. You will need numpy, cairo, and pygobject. I think except for numpy everything was installed on fedora. To change the polynomial or drawing parameters you need to change the code. It’s not really documented, but it should not be too hard to find where to change things. It’s less than 150 lines long, and you should take into considerations that I’ve never before written a line of python code, so there might be some things which are ugly. I did have the advantage of knowing GTK, though I never used Cairo before and I only vaguely knew how it works. It’s probably an hour or two’s worth coding, the rest of yesterday afternoon was spent on playing around with different polynomials.

What it does is randomly pick z points in a rectangle, by default real and imagnary parts going from -1 to 1. Each z point has a certain color assigned. On the left hand side of the plot you can see the points picked along with their colors. Then it solves the polynomial and plots the two (or more if the polynomial of higher degree) solutions on the right with those colors. It uses the alpha channel on the right so that you get an idea of how often a certain point is picked. Anyway, here is the resulting plot for the polynomial given above:
Plot of the polynomial given above.

I am glad to report (or not glad, depending on your point of view) to report that using the code I did find a counterexample to a Lemma I was trying to prove. In fact the counterexample is essentially the polynomial above. That is, I was thinking you’d probably have to have hit every t inside the “outline” of the image if all the roots were 0 at zero. It turns this is not true. In fact there exist polynomials where t points arbitrarily close to zero are not hit even if the outline is pretty big (actually the hypothesis in the lemma were more complicated, but no point in stating them since it’s not true). For example, t^2+zt+\frac{z}{n}=0 doesn’t hit a whole neighbourhood of the point t=-\frac{1}{n}. Below is the plot for n=5. Note that as n goes to infinity the singularity gets close to t(t+z) = 0 which is the union of two complex lines.
Plot of the polynomial given above for n=5.

By the way, be prepared the program eats up quite a bit of ram, it’s very inefficient in what it does, so don’t run it on a very old machine. It will stop plotting points after a while so that it doesn’t bring your machine to its knees if you happen to forget to hit “Stop”. Also it does points in large “bursts” instead of one by one.

Update: I realized after I wrote above that I never wrote a line of python code that I did write a line of python code before. In my evince/vim/synctex setup I did fiddle with some python code that I stole from gedit, but I didn’t really write any new code there rather than just whacking some old code I did not totally understand with a hammer till it fit in the hole that I needed (a round peg will go into a square hole if hit hard enough).

Syndicated 2012-05-30 17:16:11 from The Spectre of Math

Return to linear search

So … apparently searching an unordered list without any structure whatsoever is supposed to be better than having structure. At least that’s the new GNOME shell design that removes categories, removes any ordering and places icons in pages. The arguments are that it’s hard to categorize things and people use spatial memory to find where things are.

The spatial memory was here before with nautilus. It didn’t work out so great. No people don’t have spatial memory. For example for me, I use a small number of applications often, I put their launchers somewhere easy to reach. The rest of the applications I use rarely if never. No I do not remember where they are, I do not even remember what they are named. E.g. I don’t remember what the ftp client list, but I am not a total moron and I correctly guess to look for it in the “Internet” menu which is managable. Given I’ve used ftp probably once in a year, I do not remember where it is. Another example is when Maia (6 year old) needs a game to play. I never play games, but I have a few installed for these occasions. Do I want to look through an unordered list of 50-100 icons? Hell no. I want to click on “Games” and pick one. 95% or so of applications i have installed I use rarely. I will not “remember” where they are. I don’t want to spend hours trying to sort or organize the list of icons. Isn’t that what the computer can do for me? Vast majority of people (non-geeks) never change their default config, they use it as it came. So they will not organize it unless the computer organizes it for them. I have an android tablet, and this paged interface with icons you have to somehow organize yourself is totally annoying. One of the reasons why I find the tablet unusable (I don’t think I’ve turned it on for a few months now). That interface might work well when you have 10 apps, but it fails miserably when you have 100.

If I could remember that games are on page 4 (after presumably I’ve made a lot of unneeded effort to put them there) I can remember they are in the “Games” category. Actually there I don’t have to memorize it. Why don’t we just number all the buttons in an application since the user could remember what button number 4 that’s right next to button number 3 on window number 5 does. I mean, the user can use spatial memory right?

Now as for “that’s why there is search” … yeah but that only works when you know what you are searching for. I usually know what I am searching for once I found it. It’s this idea that google is the best interface for everything. Google is useful for the web because there are waaaaay too many pages to categorize. That’s not a problem for applications. Search is a compromise. It is a way to find things when there are too many to organize.

The argument “some apps don’t fit into one category neatly” also fails. The whole idea of the vfolder menus was that you could have arbitrary queries for submenus. You can have an app appear in every category where it makes sense. Now just because people making up the menus didn’t get it just right doesn’t make it a bad idea. Also now this leads to a lot of apps without any categories. The problem I think is with the original terminology. When I was designing this system I used “Keywords” instead of “Categories”. But KDE already had Keywords, so we used Categories, but you should think of them as Keywords on which to query where the icon appears. It describes the application, it doesn’t hardcode where it appears. Unfortunately, there seems to be a lack of understanding of this concept which always led to miscategorization. For example someone changed the original design to say some things were some sort of “core categories” or whatnot and that only one should appear on an icon and that there will be a menu with that name. That defeats the purpose. It’s like beating out the front glass of your car and then complaining about the wind.

Finally, what if I lend my computer to someone to do something quickly. No I am a normal person, so I don’t create a new account. And even if I do create a new account, the default sorting of apps is unlikely to be helpful. If someone just wants to quickly do something that doesn’t involve the icons on the dash, they’re out of luck if I have lots of apps installed. Plus at work I will have a different UI, on my laptop I have a different UI, and any other computer I use will have a different UI. I can’t customize everyone of them just to use them.

As it is, if I had a friend use my computer with gnome-shell they were lost. If it’s made even less usable … thank god for XFCE, though I worry that these moves towards iphonization of the UI will lead to even worse categorization. There are already many .desktop’s with badly filled out Categories field, so there will be less incentive to do it correctly.

Syndicated 2012-05-12 17:02:31 from The Spectre of Math


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.

Syndicated 2012-05-09 20:51:55 from The Spectre of Math

317 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!