Categories
Uncategorized

Project Euler Common Lisp Helper Functions

Project Euler is a site that has math problems that can be solved with the assistance of a computer program (solving the problems without programming would take an unreasonable amount of time). The problems are fun and they are a good way to learn a programming language and some interesting math.

A few years ago I solved the first 77 problems using Common Lisp.

I intend to eventually continue solving more, maybe switching from Lisp to Matlab, Mathematica, or some other language.

The site requests that users do not share solutions, which I have no intention of doing. However, I did accumulate some helper functions that I wrote while solving the problems, and I think they could be helpful for people getting started on Project Euler using Common Lisp.

Zipped: https://github.com/dstein64/euler-lisp-helpers/zipball/master
Repository: https://github.com/dstein64/euler-lisp-helpers

Also, check out Solving Project Euler Problems for some additional ideas.

Categories
Uncategorized

OS X Finder Shortcuts

Update 9/29/2018: The scripts no longer work as-is on macOS 10.14 Mojave. If you’ve already installed them, you will receive the error, Not authorized to send Apple events to Finder. (-1743). A workaround is to open each app in Script Editor, copy and paste the code to a new script, and save new apps (doing this will not retain the icons, which will have to be transferred to the new apps). After doing this, launching the new apps will prompt you for permission to run. If you haven’t already installed the apps, you will receive a “Program is damaged…” message when trying to load the application in Script Editor. The workaround steps from the 1/27/2014 update below are no longer applicable, since the Anywhere option is no longer available in the security settings. This can be altered by running sudo spctl --master-disable to temporarily disable Gatekeeper before initially launching or editing the apps, and then sudo spctl --master-enable afterwards to turn Gatekeeper back on. However, even after doing this you’ll still have to use the workaround for the -1743 error described above. It would probably be easier to create the apps from scratch using the source code and icons below (be sure to export the scripts as apps using Script Editor).

Update 1/27/2014: Depending on your version of OS X, you may have to hold down the command key before and during dragging the icons to the Finder toolbar. Also, on OS X version 10.8 and newer, opening the programs may not work, instead displaying a message that “Program is damaged and can’t be opened. You should move it to the Trash.” To prevent this from happening, open Gatekeeper settings located in System Preferences > Security & Privacy. Make a note of the current setting for Allow apps downloaded from:, and then change it to Anywhere and confirm by pressing Allow From Anywhere. Once each of the programs on your toolbar has been successfully launched, they no longer go through Gatekeeper. You can restore Gatekeeper settings to your original option noted earlier.

Update 3/4/2012: The zip file now includes the updated version of the muCommander launcher (see comments).

I have uploaded a bunch of AppleScript scripts that I have found useful in OS X’s Finder. They are described below. They were saved with the .app extension. I believe that I did this so that the icons would appear correctly in the Finder toolbar.

I recently started using OS X after years of using Windows and Ubuntu. Over the summer, I purchased the MacBook Air. I had not used OS X very much in the past, but I liked the idea of having a sleek user interface on top of a Unix-based OS, which would have tools that I’m familiar with from Linux (or if not, would be available). Additionally, two software packages that prevented me from switching from Windows to Linux in the past were available for OS X, Adobe CS and Microsoft Office. Also, there was no PC laptop that was as thin and fast as the MacBook Air. I believe this might have changed with the new Ultrabooks that have been released recently.

Anyhow, after a few months of using OS X, I have accumulated a few Finder scripts that I have found useful. I downloaded some of these that were already available (and possibly modified them) and wrote the ones that I couldn’t find. The image below shows the shortcuts to these scripts in my Finder toolbar.

Categories
Uncategorized

Google Images Search by Image

Google Images has a new feature called Search by Image that lets users search the web using an image. The feature was added a few days ago and is described on Google’s Inside Search site.

To test the feature I tried to recall a time when I was unable to find additional information about an image. This has happened a few times while browsing photography and image sites, where an image’s source is sometimes not cited. However, since I didn’t save links when this occurred, I tried to recall other images that I found on the web for which I was unable to find additional information. I remembered the following video on YouTube, which plays a slide show of images to The xxs song Intro.

http://www.youtube.com/watch?v=lX5cAzP8wzY

The first time I saw this video, I was curious about the image at 1:20 into the video. I tried contacting the user who uploaded the video, but I was only able to find out that the image was from deviantArt and no longer accessible. I noticed in the comments that other YouTube users also sought information on the image. Although there is nothing very specific in the image that I could use in a search query, I remember trying to find the image using Google, and I probably used queries containing the keywords nails, eyes, face paint, and other keywords that ultimately did not lead me to the information I sought.

Categories
Uncategorized

5/21/2011 Quote of the Day – Why Study Math?

I just came across the following video from WeUseMath.org. The site aims to answer the question “When will I use math?”

Today’s quote of the day is from David Bailey (at 4:52 in the video).

It’s worth doing. It’s something that, I’ve never heard anyone say, “I wish I didn’t take so much math.”

I cannot recall anyone I know expressing regret for taking too many math courses, but I have heard people express regret for taking too few.

I’m reminded of the following quote from Paul Graham.

But while you don’t literally need math for most kinds of hacking, in the sense of knowing 1001 tricks for differentiating formulas, math is very much worth studying for its own sake. It’s a valuable source of metaphors for almost any kind of work. I wish I’d studied more math in college for that reason.

Undergraduation [March 2005]

The video also reminded me of the following quote from Steven Landsburg.

If you enjoy mathematics, and have a knack for it, you cannot go wrong by taking math courses no matter where you think you’re eventually headed. Top-ranked economics Ph.D. programs almost always prefer to admit students with strong math backgrounds over students with strong economics backgrounds; I’m told the same is true in biology and I suspect it’s the same way in many other disciplines. In the economics department where I teach, we frequently admit math majors with few (or even zero!) economics courses on their transcripts; we would never admit an economics major with inadequate math training.

The Big Questions, p. 240 [2009]

Fortunately, with all the free courses available on the internet, it’s now possible to take more math (for free!). Check out the OCW Consortium site for information on available courses. For another example of mathematicians faring well, check out the Wall Street Journal’s 2009 article, Doing the Math to Find the Good Jobs.

Categories
Uncategorized

5/20/2011 Quote of the Day

Today’s quote is from Gilbert Strang.

This is like a grown-up course. I’m figuring you’re here to learn, so it’s not my job to force it. My job is to help it, and I hope this is some help.

MIT 18.085 Computational Science and Engineering I, Recitation 1 (49:18) [Fall 2008]

The quote conveys Strang’s priority to help students learn.

Schooling can sometimes present obstacles that interfere with learning. Credits, requirements, grades, rote assignments and other aspects of school can all distract from learning. While I understand their intended purpose, I suspect that there are ways to minimize such distractions. Treating a course as a “grown-up course” sounds like it might be Strang’s way to mitigate distractions, benefiting the students that are “[there] to learn.”

The distinction between schooling and education is addressed in the following quote, attributed to Mark Twain.

I never let schooling interfere with my education.

I haven’t been able to trace the quote’s origin. The quote conveys Twain’s belief that the objectives and/or outcomes of schooling and education are misaligned.