Jones Vectors and Visualizing Polarization

I recently had an assignment wherein I was presented with a handful of polarization states and asked to estimate the Jones vector for each one. Usually this isn't so bad, as there is only so much variation between linear, elliptical, and circular, however they also asked that I add the appropriate phase such to have the vector indicate a specific point in the trajectory. I spent some time thinking it through, but did finally decide to spend a bit of time writing a program to check my answers. Parametric plotting in Python turned out to be trivial, so it went quick. The result of that is this script, which creates two functions. One of them, jones_plot(), will take in a two-element Jones vector and generate a 2D plot of the trajectory of the tip of the electric field vector. That is, circular polarization will draw graphs of circles, and so on. The second of them, jones_check(), takes in the same Jones vector, but returns a string describing the nature of the polarization.


jones_check([exp(-1j*pi/2), -0.5j])
=> 'Linear polarization at 26.565051 degrees CCW from x-axis'
jones_check([exp(-1j*pi/4), -0.5j])
=> 'Right elliptical polarization, rotated with respect to the axes'

 

The jones_plot() output for [ exp(-1j*pi/4), -0.5j ]
The jones_plot() output for [ exp(-1j*pi/4), -0.5j ]. Red dot indicates phase = 0, green dot indicates phase = pi/5
The code is probably not bullet-proof, but it provided a good means for practicing manipulating the vectors and understanding how to interpret them. For the curious, the sign convention used is decreasing phase in the style of Hecht's Optics 4th edition.

LaTeX Header Files: Making Life Slightly Easier

I compose a lot of documents in LaTeX. Homeworks, course notes, personal records, and meeting minutes all get typed up in TeX at some point. While the majority of the commands are quick to learn and easy to use, there are a few cases that popped up again and again that took a non-trivial amount of time either to type or to remind myself how it was done. Accordingly, some time around two years ago I started putting together a header file that I could include at the top of a document via \input{../physics_header.tex}, and it would take care of the majority of the packages and the like. While one can argue that I shouldn't have a bunch of packages included when I don't need them, the compile time is essentially negligible compared to the 3-second headache of having to go back and add "\includepackage{graphicx}" every time I want to add an image to a document.

After a bit I realized it was an ideal place to store my oft used, as well as my not-so-oft used, custom commands. I ended up bringing together the majority of the custom commands I'd written so far and organizing them by category. They mostly covered vector calculus, matrices, and quantum mechanics notation. I encourage you to take a look at the PDF I've put together regarding the commands, and if they're useful to you, grabbing a copy of my header and taking the useful bits for your own. Given that LaTeX allows me to include symlinked files, it's been very easy to sync the header across systems with Dropbox and continue using my commands everywhere.

That all being said, I have been cautioned about getting too comfortable with custom commands, as some academic journals that accept TeX files for compilation on their end aren't especially fond of them. It hasn't been an issue for me yet, but if it ever is I imagine writing a quick script to un-shorthand all of these things would be quick.

WordPress Upgrade Headaches

WordPress prompted me to update to the latest version, and of course I figured nothing would go wrong. The update ran well enough, but I was totally unable to access the back-end of the website afterward. The process was running out of memory. I discovered that my host, NearlyFreeSpeech.net limit the amount of memory for each PHP process to 32MB unless you pay an extra fee. It's not much to get it bumped up to 64MB, only a few cents a day, but I always prefer the cheaper option. I was able to regain access to the admin panel by renaming the folder /wp-content/plugins to /wp-content/plugins.old, which prevented them from being loaded.

In the mean time I also went ahead and installed W3 Total Cache and, in doing so, ran headlong into another problem. It seems the 'tmp' folder created by the installation script does not belong to the same user as my FTP account, so even with permissions set to crazy (777) I was unable to save any settings. I had enough privileges to rename it and create a new 'tmp' folder, which ironed out the problem. Hopefully the site is running a little faster for everyone as a result.

Quiet for a while

I've not kept up with the idea of posting twice each month, and as much as I would like to say that's because I've been too busy to write it would be more accurate to say that I've been too busy to pursue interesting projects on which I could write. I've mostly been readjusting to life back in Tucson after a summer away and settling back into old routines. I did take the time to make a 2.5 lb batch of jerky which received positive reviews, the recipe can was found here and only the amount of liquid smoke was altered (1 cup sounded insane, used 1/8th instead). I'm going to make a renewed effort to update this blog as projects come along.