Categories

## Bringing Ustream and Justin.tv back to life

Tried to watch the Make: Live! webcast about the Arduino this evening, but was unable to view the video stream on my computer. All I got was a black screen. Tried viewing the webcast directly from the Ustream site, but still got nothing.

Marching through the standard troubleshooting steps, I removed all script blockers and ad-blockers, and shut down my software firewall. Still nothing.

To verify that I could still view video, I went to the TWiT Live page and confirmed that my computer handled the BitGravity stream without difficulty, but both the Ustream and Justin.tv streams failed to function properly. As a final check, I went to YouTube, where videos displayed without a problem. To see if this problem was limited to my preferred browser, I shut down Firefox and launched Internet Explorer. Same results. So something was acting on a system-wide basis.

After several rounds of searching on Google, I eventually stumbled upon the solution. It seems that you must tell the Flash browser plugin to permit third parties to store information on your system. I’m not happy about allowing Flash cookies, but if you don’t permit this, you won’t be watching Ustream or Justin.tv. I haven’t (intentionally) changed these settings in months (maybe years?), so I don’t know why I’m just now having problems. Anyhow, I thought I’d make this post just in case somebody else is experience the same difficulty.

If you are a Firefox user, you might want to install the Better Privacy add-on, just to simplify the process of removing Flash cookies, which are now going to be added to your system every time you view Ustream or Justin.tv videos. Be sure to “protect” the settings.sol folder in Better Privacy, or your settings will be forgotten every time you shut down Firefox.

[Update: After submitting this post, I went back and returned the Flash plugin settings to their original values. After deleting the other Flash cookies and restarting the browser, I had no problem viewing the Ustream and Justin.tv feeds on the TWiT page. Still don’t know exactly what caused the problem, but allowing third-party data storage on a temporary basis seemed to clear the logjam.]

[Update 2: Nope, I had accidentally deleted the settings.sol folder cookie. Once I locked things down solidly, Justin.tv would no longer work. So ignore the prior update… you apparently must allow Flash cookies to watch certain webstreams.]

Categories

## Making Beamer Better

I use Beamer a lot for presentations, and I’ve gotten pretty good at the editing cycles that it requires. Unlike in PowerPoint, Beamer doesn’t allow me to simply click and drag an object to a new spot. Rather, to move something on the slide, I have to edit the LaTeX code, entering a command like \vskip0.2in to give me an additional bit of space between a couple of equations or text elements. It sometimes takes numerous iterations to get things right. This doesn’t both me, as I love being able to write entire presentations in LaTeX. What I want, however, is an ability to speed up the iterations.

If I could place the document preamble in one file, and the code for each slide in individual files, then it should be possible to create a script for compiling just one slide at a time. Then, I wouldn’t have to wait while Beamer compiled all 100+ slides in a presentation deck every time I make an edit. (Yes, that’s a lot of slides, but the count goes way up when I use multiple slides to reveal an equation one line at at time.) I can comment out code to limit compilation time, but it’s slow and cumbersome, and I once found myself in the middle of a presentation with missing slides because I forgot to uncomment about a third of my presentation file. So I want a supervisory program that will handle the individual code blocks, and allow me to compile the entire document when I’m finished.

If such a program exists, I’d sure like to know about it. If not, then maybe I’ll get around to writing it someday. 🙂

Categories

## When to introduce the matrix exponential?

In the study of linear systems, a familiar relationship is the homogeneous state-space equation \dot{\mathbf{x}}=A(t)\mathbf{x}(t), where \mathbf{x}(t) is an n-vector, and A is an n \times n matrix. The time-invariant solution, (i.e., when A is a constant matrix), is \mathbf{x}(t) = e^{At} \mathbf{x}_0. When this subject is first introduced, the solution is often assumed, rather than derived.

The thinking is that since the solution to the homogeneous scalar equation is x(t) = e^{at} x(0), then students will willingly accept a matrix-friendly equivalent that solves the state-space differential equation. So the definition for the exponential matrix is given, and is shown to work for the homogeneous case:

\begin{aligned} \dot{\mathbf{x}}(t) & = \frac{d}{dt} \left( e^{At} \mathbf{x}_0 \right) \\ & = \frac{d}{dt} \left( e^{At} \right) \mathbf{x}_0 + e^{At} \frac{d}{dt} \left( \mathbf{x}_0 \right) \\ & = A e^{At} \mathbf{x}_0 + e^{At} \left( 0 \right) \\ & = A e^{At} \mathbf{x}_0 \\ & = A \mathbf{x}(t) \end{aligned}

It seems to me that this presentation sequence, however, masks what is really going on with the system; that there is an infinite recursion on the initial state, \mathbf{x}_0, that converges to a value for \mathbf{x}(t):

\begin{aligned} \mathbf{x}(t) & = \mathbf{x}_0 + A \int_0^t \mathbf{x}(\tau)\, d\tau \\ & = \mathbf{x}_0 + A \int_0^t \left[ \mathbf{x}_0 + A \int_0^t\mathbf{x}(\tau)\, d\tau \right]\,d\tau \\ & = \mathbf{x}_0 + A \int_0^t \left[ \mathbf{x}_0 + A \int_0^t \left[ \mathbf{x}_0 + A \int_0^t\mathbf{x}(\tau)\, d\tau \right] d\tau \right]\,d\tau \end{aligned}

This recursion obviously repeats ad infinitum. However, the matrix exponential can now be defined by collecting terms on the right hand side, leading to:

\begin{aligned} \mathbf{x}(t) & = \left[ \mathbf{I}_n + At + \frac{1}{2!} \left( At \right)^2 + \dots \right] \mathbf{x}_0 \\ & = e^{At} \mathbf{x}_0 \end{aligned}

Presented in this order, the exponential matrix is developed based on system response, rather than the other way around. This strikes me as being easier to comprehend than “guessing” that some seemingly arbitrary function might solve the problem. Is this conceptually easier for anyone else?

Categories

## Getting Inkscape to play nicely with PSfrag

While browsing through some of the old TeXtip posts on Twitter, I was reminded of the possibility of using Inkscape to generate LaTeX-compatible illustrations. Given the vast amount of cruft that Illustrator includes in its EPS files, this sounded like it might be a good alternative.

However, Inkscape seems to be having some of the same problems as I was recently experiencing with Adobe Illustrator. Long story short, the only way I could find to make Inkscape play nicely with PSfrag was reverting to version 0.46. (The most recent Inkscape release is version 0.48.)

This problem is related to the use of the Cairo package from the GTK+ Project to export EPS files. Rather than store strings directly, references are made to a structure of characters actually used in the file. This is done to reduce file size, and improve performance. However, this is a real problem for those of us that use PSfrag. Specifically, string “abc” is no longer identified in the EPS file as (abc)Tj, but rather <01020304>Tj . This makes it impossible for PSfrag to find a matching string. There is some indication that a newer release of Cairo will fix this problem, but it hasn’t yet worked its way into the public release.

While some nice LaTeX-rending features are being introduced into the more recent releases of Inkscape, the benefit of PSfrag was nicely expressed by commenter emw on a Inkspace forum:

The reason for using psfrag is a kind of “coding style”, because I use a lot of complex symbols/equations defined by \newcommand statements in the latex document. For a consistent layout, I’d highly prefer to reuse these commands via psfrag in the figures.

I heartily concur.

Categories

## Getting Illustrator to play nicely with PSfrag

When creating diagrams for inclusion in a Beamer presentation, I used to use the drawing package in Open Office. Then I could use PSfrag to replace drawing text with text rendered in in \LaTeX. This made all the symbols in the presentation match symbols on the diagram. Alas, I am no longer able to make Open Office work with PSfrag. (My old trick of modifying the EPS “textmode” value in the OO configuration file no longer works.)

No problem, I thought. I’ll use Adobe Illustrator instead. However, I could only get this arrangement to work if the drawing text consisted of single letters. Not a huge problem, I suppose, as there are 52 possible identifiers just using upper and lower case letters in the English alphabet. However, it is sometimes a bit difficult to remember if x_3 is being represented by “p,” or “q,” or some other letter.

So here’s a solution to the problem, that I found on Giovanni Lanzani’s blog. When saving the EPS file in Illustrator, select “Illustrator 3 EPS” in the “version” pulldown. Don’t use “Illustrator CS3 EPS.” The newer versions write out the text one letter at a time, thus preventing the PSfrag routine from finding a matching string. Apparently the older EPS export routine doesn’t mangle the drawing text in this manner.

Categories

## Mathematicians write like novelists

As I attempt to teach myself something about stochastic calculus, I have been reading a great many articles, and several textbooks, on the subject. It has left me with the distinct notion that mathematicians hate to spill the plot too early in the story. Each proof builds upon clues that have been scattered throughout the text, just as a writer might have the butler passing down a hallway in the second chapter for no apparent reason. Lemmas and sub-theorems that, to all outward appearances, are wholly unrelated to the general theme begin to appear. Then slowly, sometimes painfully, these logical manipulations are pulled together as the proof draws to a conclusion. But even so, the mathematician is reluctant to come out and say, “the butler did it.” Rather, phrases like “it is clearly obvious,” and “it is easily proven” are used to inform the reader that the point of mathematics is the mental challenge of figuring out how the pieces fit together.

There is no enjoyment in reading a novel that lays out the entire plot in the first paragraph. So a plot is simply a literary construct used by authors to evoke emotion, just as sculptors do with statues, and dancers with physical movement. Likewise, spelling out every mathematical truism and trick would make a proof lengthy and boring, with no pleasure left to be savored, right? So I think that mathematicians must write proofs (whether intentionally or not) in a manner intended to allow other mathematicians to sense the thrill of unraveling a logistic knot.

Sometimes I enjoy this artistry. Today I do not. 🙁