Scientific Programming Study Group

Notes from Jan 21 and 27, 2010 Scientific Programming Study Group

Jim Emery is a member of Kansas City’s STEM2 society. He has started a Scientific Programming Study Group recently at the CCCKC hackerspace. STEM2 is a group that promotes Science, Technology, Engineering and Mathematics. The topic is based on his document titled “Scientific Calculating, Programming and Writing” which can be found at the Stem2 web site.

Using Python

Jim chose the Python language for these sessions. It is a powerful language with many features that make scientific computing easier.

Finding documentation on Python:

Getting Started in Linux

Since I’m using Ubuntu Linux, Python is already installed. To work through Jim’s examples I need to create the following new directories in my home folder “/vthompson“.

  • /bin
  • /tmp
  • /src

The next step is to open a command window and adjust the $PATH variable so any programs placed in the /bin folder can be found. First, keyin the command echo $PATH to see how this environment variable is already defined.

PATH Environment Variable

PATH Environment Variable

From the picture above, we see the /bin directory shows up in in several places. Surprisingly, the directory I just created in my home directory already shows up. How did this happen? The answer can be found in the hidden shell script also found in my home directory,  vthompson/.profile. It contains the following code segment that automatically places a home directory’s /bin path as the first one in the PATH list.

# set PATH so it includes user’s private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH=”$HOME/bin:$PATH”
fi

A good place to find more information is the Ubuntu Documentation page on Environment Variables. Also, for more information about shell scripts check out the Beginners Bash Scripting page. Another helpful document if you’re just starting to work with the command line is this CategoryCommandLine document.

Purpose of the /bin Directory

Linux is designed as a multi user operating system. While your desktop or laptop computer may not be used by other people logging into different accounts, using the home directory’s /bin folder prevents our special programs from interfering with someone else’s computer usage habits.

Now, its time to populate the /bin directory with files from the STEM2 software listing. The files we need are linux.zip and py.zip. Download and unzip the contents into /bin.

Trying a Sample Program

From Jim’s book, Chapter 6 on Graphing and Programmable Calculators, I’m trying the square root sample. I’ve created a /src directory to place my program source code into. Here is the sample program written using the gedit editor:

Squareroot Source Code

Squareroot Source Code

And the resulting screen shot of the program:

Squareroot Example Python Program

Squareroot Example Python Program

Other Python Notes:

About SomeoneKnows
(c) 2010 Vince Thompson

Making It To The Party – Day 23

2.13.2009 (Friday) –  Day 23  –

The Party Game That Rocks…

HackDC Party

HackDC Party

Our original wooden labyrinth spent last weekend in Washington DC with Bill (@hevnsnt). The HackDC group threw a party and Bill picked a prime location for this party game. Bill posted more pictures on his flickr account.

Behind the scenes…

Reports were all great from the SchmooCon and HackDC party where everyone seemed to love the labywiinth party game. The behind the scenes activities leading up to the party reveal some hectic challenges to get everything working.

The decision to take it to DC was made just a couple of days before Bill flew out. He was going to operate the game from his own computer and we didn’t have time to test anything out before he left. As usual, demo mode kicked into effect and things weren’t working. Jestin has an interesting chronicle of events on his web site titled Remote Robot Debugging.

Bill said he put the labyrinth in a protective box buried deep in his checked luggage. I though he should take the game as carry on instead. It would have been interesting hearing his explaination to TSA about this device with a timer thingy, motors, and wires hanging off.

Read on, check out: Day[24] = 2.14.2009
Yesterday, check out: Day[22] = 2.12.2009
Or start from the beginning: Day[0] = 1.21.2009

About SomeoneKnows

Labyrinth Simulation – Day 8

1.29.2009 (Thursday) –  Day 8 –

Jestins Simulation Program

Jestin's Simulation Program

Jestin has been developing on a simulation program that takes the Nintendo WiiFit data stream using its Bluetooth communications and is directing the graphics in this program. He was showing it off at the CCCKC meeting tonight. To read more about Jestin’s program check out his Virtual Labyrinth blog post.

Speaking of Nintendo Wii paraphernalia, check out these WiiMote stereoscopic glasses over on Bre Pettis’ blog.

We missed Tom at the CCCKC meeting tonight. He was attending an XNA (XBox) game programming special interest group just getting started. I was wanting to go too but it was at the same time as our meeting this evening. Tom said that they discussed making their group into a CCCKC study group.

Read on, check out: Day[9] = 1.30.2009
Yesterday, check out: Day[7] = 1.28.2009
Or start from the beginning: Day[0] = 1.21.2009

About SomeoneKnows

Using Google Notebooks for Quick Research Notes

Since we don’t have electricity on our property, I’ve been doing a lot of research on the Internet while I’m in the city about ways to reduce or eliminate dependence on the electric company. Earlier in the week I visited a lot of sites but didn’t record all of the interesting web addresses. I’m not particularly fond of the Bookmark features in the browsers and I’ve used shortcut icons on the desktop before but I prefer Google Notebooks as a way to store interesting links with comments. So, I started recording many of my links using Google Notebooks. Google has a way of sharing contents with others, so here is a link to my Alternate Energy Research notebook: AlternateEnergyResources

I’m using the Firefox browser now instead of Microsoft Internet Explorer and have good results. My computer is set up to dual boot with Ubuntu Linux and Windows so Firefox is convenient when switching between operating systems. I downloaded the Google Notebook Firefox Extension from http://www.google.com/notebook/download and it really helps the note taking process. There is a “Open Notebook” icon at the bottom right corner of my browser. Another good feature is when I select text from a web page I can right click and select the “Note This (Google Notebook)” option and it creates a new item in my notebook.

This works great while connected to the grid and Internet but what about those off-grid times. Google Notebook has a “Manage Notebooks” option that displays a list of your notebooks. There is an “export” tool that lets me export the notebook with the “Document” option. That creates a Google Docs file which has an option under File->Download File As->PDF option that I like to use or select other word processing document formats. I’m using OpenOffice instead of Microsoft Word so I can save to the ODF (Open Document Format) if I choose. Now I can open any of my notebooks without being connected to the Internet. I really wish the Linux program Tomboy which is similar to Google Notebook had a synchronize feature.

Follow

Get every new post delivered to your Inbox.