12 September 2013

Worst open source release ever: Suzerain

Though it's far from in a public-ready state, I'm tired of my research code, Suzerain, having no public presence whatsoever:

Though primarily my baby up until a year ago, the cast of characters now includes all of whom are affiliated with The Center for Predictive Engineering and Computational Science (PECOS) within The Institute for Computational Engineering and Sciences (ICES) at The University of Texas at Austin.

This work is supported by the Department of Energy [National Nuclear Security Administration] under Award Number [DE-FC52-08NA28615].

11 September 2013

Somewhat taming the bump function's derivatives

Often I need to initialize some smooth pulse in a simulation. Today, for example, I'm working with acoustic and entropy pulses to test the effectiveness of nonreflecting boundary conditions for the Euler equations (see, e.g., Baum et al). Bump functions are nice for this purpose as they're infinitely smooth and have compact support.

Awhile back I realized that using just a classical bump function produced large gradients which had to be resolved. Years ago I used Mathematica to see if taking some power of the classical bump function, which remains infinitely smooth, could produce smaller gradients better suited for numerical use.

The punchline is that using the fourth power of the bump function, BumpPower[4] in the following parlance, is Goodness (TM). The following Mathematica notebook demonstrates the problem and discusses how one arrives at this empirical result:

13 August 2013

The obligatory XMonad configuration post

Since I've been loving XMonad for the past several months on a 2-up desktop and a 1-up laptop, here's the obligatory personal XMonad configuration post:

General comments:

  1. This started from the vanilla, session-manager-aware Fedora XMonad configuration.
  2. The Windows key is the modifier.
  3. The default dmenu_run key, mod-p, interferes with some monitor-swapping hotkey on Ubuntu. Hence the second keymapping.
  4. Toggling maximization in one keypress has been handy.
  5. I like the mod+arrow combinations better than the suggested CycleWS ones. Rather than moving through a bunch of empty workspaces, these permit you to just move through workspaces with windows and to get a clean workspace with a single keypress. Much thanks to Marshall Lochbaum and Brandon Allbery for chiming in on the XMonad mailing list with the followTo implementation.
  6. The prev/next screen items permit throwing windows back and forth when 2-up.
  7. I find the REFLECTX binding handy when 2-up to push the non-main chat window off to the leftmost monitor position.
  8. Layout.Tabbed's simpleTabbed is additionally available as a layout option.
  9. New windows spawn outside the master pane with the master window keeping focus.

Please drop a comment if you happen to find anything useful or want to contribute a tweak.

24 July 2013

Python should have Haskell's $ operator

In Python, I often want to repeatedly say "apply some function to the remainder of the current statement". Think foo(bar(baz(qux, quux))). In my text editor, which mostly automatically handles the parenthesis correctly, this is a quick thing to type.

Within IPython, statements like that are tedious. IPython does have a limited version of this in its automatic parenthesis feature. Notice how many syntax error gotchas lurk in those examples.

Haskell's $ operator is pretty sweet. All of the following are equivalent in Haskell:

putStrLn (show (1 + 1))
putStrLn (show $ 1 + 1)
putStrLn $ show (1 + 1)
putStrLn $ show $ 1 + 1

Python should adopt Haskell's $ operator. That is, the following should be equivalent:

foo(bar(baz(qux, quux)))
foo $ bar $ baz(qux, quux)
foo $ bar $ baz $ qux, quux
Though odd looking, there's easy consistency for unary functions:
foo()
foo $

Haters of the new-ish print might find respite in print $ foo.