Thursday, February 7, 2013

A mnemonic for the 48th Mersenne prime formula

The 48th Mersenne prime was discovered on 25 January 2013 using GIMPS ( In lieu of memorizing the 17,425,170 digits it might be easier to memorize the formula, \(2^{57885161} - 1\), but even the exponent \(p=57885161\) might prove a bit dodgy for long-term recall. So, in the spirit of play I sought another way to help remember the exponent which may not be easier but provides an algorithm to cross-check my memory. And the mnemonic is … 27, or more precisely, what is the answer to 9X3= written in hexidecimal?

While there is no compelling rhyme or reason to equate 9X3= or 27 with the exponent of the 48th Mersenne prime formula, maybe this small act of recreational mathematics will help the brain make loose connections tight into a memory.


Friday, January 27, 2012

Is the power of LaTeX a disservice to the reader?

CLOSED: 2012-01-27 Fri 20:56

Nearly three years ago, as March went out like a lamb, I pondered the ways in which LaTeX may hinder communication and wrote the letter below.

Yesterday I spent a terrifying number of hours in Microsoft Project analyzing why the equation

Duration = Work/Units

was not an equality for the scheduled tasks. In the midst of the enquiry my thoughts turned philosophical in an attempt to escape this mathematical morass.

I began to see how some of the recent efforts to incorporate LaTeX in our toolbox may actually be an obstacle to resolving larger problems in our communication. For example, the FDA reports that µ g should not be used in handwritten medication orders because it can be ``mistaken for "mg" (for milligram), creating a 1000-fold overdose''. In light of the serious health consequences it should not be a surprise that the recommendation is to ``write mcg'' instead. One of the reasons that doctors may be lured to handwrite µ g is the fact that it appears in printed form. Indeed, it may behoove authors for certain audiences to refrain from the troublesome symbols. Writers who use wordprocessors are ahead of the trend because symbols are so difficult to obtain.

Acronyms are another area where LaTeX functionality is actually a step backwards in the quest for clear communication. Simply put, acronyms should not be used since they interrupt the narrative flow and sometimes even obscure the meaning to the uninitiated. The feature of including expansions for all acronyms in a LaTeX document appears at face value to be a benefit. On the other hand, it could be contended (and quite convincingly so) that this feature simply perpetuates a practice that should be abolished altogether. Since thorough acronym lists are difficult to write and maintain with wordprocessors, those authors are working hand-in-hand with the frustrated reader of the unexplained acronyms to hasten their demise in written communication.

In retrospect, I am quite surprised at how long it took me to realize how using LaTeX can actually hinder the reader's intellect. In all my jabbering about ``coherent documents'' and ``clear communication'' in symbols and references and styles, it never once occurred to me that the reader might need something different. For instance, documents that have symbols in equations that do not match symbols in the text are encouraging the reader to take an active part in learning the material. The astute reader will immediately note the mismatch, and a myriad questions will flood their mind. The author has, wittingly or not, invited the reader to an invigorating journey of discovery to understand the true intent of the writing.

Continuing on those same lines, providing links or even simply references to numbered objects in the document allows the reader a lazy approach. Instead of using their own brainpower to recall what has been written and where, thorough and correct references provide no impetus for the reader to delve deeply into the document. On the other hand, a work without such referential spoon-feeding is one that demands from page one that the reader be completely engaged and attentive, remembering for themselves what and where the important bits are. Of course it is almost inevitable that the reader miss or forget a vital or central idea, but then the pleasure begins anew as they search from front to back, having opportunity to learn even more. A burst of happiness is their reward upon finding the object of their search, and if they do not happen upon their quarry they may use their own judgement to conclude that it is not important anyway.

To simplicity,
Timothy C. Burt
01 Apr 2009


Monday, August 8, 2011

Emacs lisp functions for word lookup using web services

2011-08-08 Mon 19:47

Without any commentary about Xah Lee besides this preemptory caveat that there is alot of commentary about him, there are some useful functions from his website\_lookup\_ref.html. The two used here are both lookups based on the word under the cursor for either a definition or wikipedia.

In the original definition of his function lookup-word-definition the web service is hard-coded. In preparation for making the particular web service configurable we need to know what might be available and a sense of the API. Xah Lee also had a list of online dictionaries (\_dir/Vocabulary\_dir/dictionary\_tools.html) along with an example for the word 'curlicue'.

American Heritage Dictionary (AHD)
AHD, Random House, …
Merriam Webster Collegiate
Compact Oxford English Dictionary\_oed/curlicue
Oxford Advanced Learner's Dictionary
Open Source Dictionaries*&Query=curlicue
Google dictionary
  • "Google Dictionary is no longer available."

First we declare a new variable, tcb/lookup-word-definition-dictquery, that points to the dictionary and prepares the query under the assumption that the word to be found is the very last part of the string.

(defcustom tcb/lookup-word-definition-dictquery
  "Dictionary and query API used in lookup-word-definition."

Now we define the function itself using the new variable.

(defun lookup-word-definition ()
  "Look up the current word's definition in a browser.
If a region is active (a phrase), lookup that phrase."
 (let (myword myurl)
   (setq myword
         (if (and transient-mark-mode mark-active)
             (buffer-substring-no-properties (region-beginning) (region-end))
           (thing-at-point 'symbol)))

  (setq myword (replace-regexp-in-string " " "%20" myword))
  (setq myurl (concat tcb/lookup-word-definition-dictquery myword))

  (browse-url myurl)
  ;; (w3m-browse-url myurl) ;; if you want to browse using w3m

Another useful function is a wikipedia lookup.

(defun lookup-wikipedia ()
  "Look up the word under cursor in Wikipedia.
If there is a text selection (a phrase), use that

This command switches you to your browser."
 (let (myword myurl)
   (setq myword
         (if (and transient-mark-mode mark-active)
             (buffer-substring-no-properties (region-beginning) (region-end))
           (thing-at-point 'symbol)))

  (setq myword (replace-regexp-in-string " " "_" myword))
  (setq myurl (concat "" myword))
  (browse-url myurl)


Friday, July 15, 2011

Testing org-googlecl after host replacement

For the last 18 months the home computer network, and especially my own machine, have deteriorated to agonizing usability. In these past few days I have enlivened the systems and things are running well. This particular post is a test of the blogging capability from emacs orgmode that is made possible by the wonderful package org-googlecl and googlecl.


Saturday, March 12, 2011

Access to URL has been blocked over 3G because of an account filter

2011-03-11 FRI 11:56

If I ever get the message "Access to URL has been blocked" surfing the web over 3G, I'll call customer service to ask if the phone number has filters applied. Here is the short story that leads to this conclusion.

We have a Samsung Captivate smartphone running the Android v2.1 operating system. Browsing the internet worked over both wireless and the 3G data network. Then came a day when 3G browsing no longer worked but wireless did. Neither research nor 'random walks through solution space' (as a friend is wont to say) yielded a solution so we went to the AT&T store for help. Even though they had not heard of this problem they were helpful and attempted some resolution to no avail.

After 20 minutes of failed attempts they still did not give up but rather brainstormed and checked assumptions. One such assumption was that the phone account itself had the proper permissions to browse the web over 3G. Since this capability worked before and we had not requested it to be disabled, it didn't seem likely that this was a problem. However, a call to customer service revealed that the phone line was indeed filtered in a way to block data, including web access, over 3G. This configuration was incorrect and never requested, but a plausible explanation is that when we requested data blocking for our daughter's line my wife's line was inadvertently blocked as well.

So, if you are getting the "Access to URL has been blocked" message, see if the line is somehow filtered.

Troubleshooting Notes

Here are some troubleshooting observations and actions we tried that failed.

  • All internet activity was successful when connected to a wireless network.
  • Some internet activity was successful when not connected to wireless but going through 3G
    • Examples are weather, local news
    • These activities had a phone application associated with them
  • Reset browser settings
  • Put into flight mode for a few minutes then return to normal mode
  • Remove battery then put it back
  • Use a different browser


Wednesday, January 19, 2011

How do I rename multiple files efficiently using only the bash shell?

2010-09-10 Fri 17:36

As a concrete example, let us consider the problem that we often have uploading pictures to certain sites (e.g. ebay). The photos from our camera all have .JPG extension. However, when we attempt to locate those pictures from some web sites, no photos are found. This is because something in the chain of events only lower case extensions, such as .jpg, are allowed.

The task is to change all files in a directory (e.g. /DATA01/Pictures/EBAY/2010-09-10) from upper case (.JPG) to lower case (.jpg) extensions.

cd /DATA01/Pictures/EBAY/2010-09-10
for i in *.JPG; do mv "$i" "${i/.JPG}".jpg; done


If the task is a bit more complex will do well to use another standard Unix tool with regular expression capability (such as sed). For example, if we have files with a date in the name (e.g. 20101210) and want to change the date (e.g. to 20110119), then here is solution.

for i in *20101210*; do j=`echo $i | sed s/20101210/20110119/`; mv $i $j; done

Still simple.

Thursday, November 25, 2010

A Crumb for Later: ffmpeg runes to generate an animation

I found a faded post-it note from a friend who gave me the following incantation to convert a set of still images into an MPEG animation using ffmpeg. This note is a crumb for later investigation.

ffmpeg -r1 -f image2 -i <input> -vcodec mpg2video \
 -r 30000/1001 -b 25000k <outMovie.mpg>

If memory serves, the 30000/1001 may need to be changed to the decimal value, but I'll see if ffmpeg will parse and calculate on its own ;-)