Wednesday, March 12, 2014

A Math Challenge

OK it's not really a challenge in the traditional sense, but I am curious about the answers that people might give.  There is no single right answer.

Here is the challenge.

I give you two boxes of apples.  One box has 3 apples, it has a giant A on it.  The other box as 9 apples, it has a giant B on it.  Describe how one box is related to the other.  I'll start with an easy one.
Box A has a different letter on it than box B.

Please answer in the comments.

Sunday, March 9, 2014

An Open Letter to Journalists Everywhere

When you report averages of things can we have some kind of error bars?

I just read an article describing changes in market share for cell phones of less than one percent.  But this is such a small change, how can we know if this is actually an accurate measurement without any sense of the measurement accuracy?

Thursday, March 6, 2014

The one where I embrace women's creativity

So one of my life goals this past couple of years has been to try to learn more about feminism and sexism in society.  I've spent some time examining my own behaviors and found one very deficient area, almost all the media I consume is written by or stars mostly men.  There is one notable exception

Here are some examples of what I mean.

Favorite Authors:  John Steinbeck, Steven King
Favorite Movie Directors/writers: The Cohen Brothers
Favorite Movies:  The Big Lebowski, Superman
Favorite Band:  Iron Maiden
Favorite Guitarist:  Jason Becker
TV shows I'm watching right now: Bob's Burgers, American Dad, Community, Super Fun Night,    Rick and Morty, Brooklyn 99

Favorite Webcomics:XKCD, SMBC
Favorite Webseries:  Half in the Bag, Todd in the Shadows
Favorite Podcasts: Accidental Tech Podcast, This Week in Tech, This Week in Google, Rationally Speaking.

So yeah with the exception of Super Fun Night, which is centered around a lady, all of these are produced by men, or are men.  There is one other notable exception and I am curious is there is a real correlation here.  Many of the podcasts I listen to feature women prominently either as a host or cohost.  This Week in Tech in particular seems to go out of its way to make sure women are on the show, though this does not always work.  In fact the field of tech journalism seems to be making much better inroads than other fields.  My favorite writer on is Casey Johnson (a lady) and one of my favorite people in the tech field is Gina Trapani.  There is also Mary Jo Foley and Joanna Stern.  This seems strange to me as tech in general has a dearth of women.  Maybe technially minded women found it too hard to break into the software game directly and found tech journalism easier to break into?  I should also mention that fully half the hosts of Rationally Speaking are women, though there are only two total hosts so that could be somewhat dubious.

Anyways, tech journalism aside, that list does not have a lot of ladies on it.  So I went on a search for media content either starring women or developed by women.

Here are a few examples and quick reviews.

Super Fun Night:  This is a TV series that is pretty similar to Andy Richter Controls the Universe, but starring a woman instead of a man, show creator Rebel Wilson .  It took a while to find its groove but has settled into a solid show.  Professional reviews have not been so kind, but I like it.

Stephen Universe: This is the first cartoon on the Cartoon Network created by a woman.  Oddly enough, the main character is a boy, but there are three other female characters.  The show is creative but I found it kind of boring and aimed at too young an audience for me to enjoy.  Still, I wish it luck.

The Legend of Korra:  I could write a whole blog post about this and then some.  Bottom line, it's decent, not as good as it could be and the character of Korra seems to change in every episode.  I hope it gets better but it was good enough to check out the new season when it airs.

Music:   I love heavy metal which is not known for including many women, and specifically shred guitar which is even less known.  I had to actively search for bands with women guitarists.

 Kylesa is probably the best overall band I found with a female lead guitarist, Laura Pleasants.  They sound kinda like Black Sabbath.  There's really not a lot to say about them other than they sound like a more punk Black Sabbath.  As far as the guitar playing, her solos are creative but not particularly demanding.

Many metal bands with women in them feature the women doing things other than guitar.  Some sing, some play violin, some play weird old timey instruments like the grind-organ.  None of the bands I found really hooked me, but they weren't bad either.  One of these bands is Halestorm, which is named after the singer Lizzy Hale.  They beat Megadeth and Anthrax for a grammy award in the hard rock and heavy metal category.  I listened to the album and while it wasn't particularly bad I thought it was boring.  It sounds like Nickleback but with a female singer.

The only solo guitarist whose music I actually did like was Gretchen Menn.  She's an excellent guitarist and musician, but her music is a little more prog-rock than the crazy aggressive guitar shredding I typically listen to.  Her guitar tone also uses a very fuzzy style distortion whereas I prefer a more chunky style distortion but that's a whole other conversation.  Anyway you should check out her music if you like instrumental rock. 

Honorable mention:  Orianthi.  She's a genuine female shredder who is an absolutely beastly guitar player but who can't write a song to save her life.  She's like the inverse Gretchen Menn.  I suspect that her producers have too much influence over the style and content of her songs. 

Books:   Well I read Pride and Prejudice and thought it was pretty good.  Austen writes good dialouge and the characters were pretty well fleshed out.  I would have liked the conflict to be a little more high stakes...but overall I enjoyed it and I would read more of her work.

Can anyone recommend a good sci-fi book written by a woman, I heard the Handmaid's Tale was good?

Movies:  I liked Bridesmaids,  I should probably watch The Heat,  I will probably write a new one in the future where I include more stuff that I missed here.

Anyway,  In conclusion...A lot of the work by ladies has a different tone and temperament than the stuff done by men and it's been hard to get over the hump of just because something is different than I am used to doesn't mean it's bad.  Gretchen Menn is the perfect example.  Her music is very good, but not the kind o guitar album I am used to.  It leads to the an interesting question of just why I prefer more agressive style music or comedy or movies, but that is for another day.  Perhaps I can learn to enjoy things that are not my typical fare.

PS, just google for the stuff I didn't link too, there's just too many links to find and I am too lazy.

PPS  Brooklyn 99 is a great show with great diversity of characters, though it focuses a bit too much on Andy Samberg's character to make this list.  I especially love Captain Holt.

Tuesday, February 11, 2014

Ben's Guide to Moving Off Windows XP

Microsoft is ending long term support for windows XP April 8th.   This means, shortly after April 8th, computers running windows XP that are connected to the internet will be all but guaranteed to be hacked or get a virus.  It will be a really bad idea to keep any computer that uses Windows XP online.
So what is the best thing to do?  Well that really depends on what the computer in question is for, the age of the computer, how much money you are willing to spend, and how computer savvy you are.

Most importantly, no matter what you do, backup your data ASAP.   If you choose to get a new computer, give your old computer to BestBuy or some other computer recycling center.   They will take care of deleting your old files and making sure that dangerous components in your computer are dealt with safely.

The main options are as follows:
1)  Backup any important data and just buy a new computer.  Use the backup to put your old files on the new computer and install the software you need.  This is an attractive option because the odds are that any computer with Windows XP is probably pretty old anyway and worth replacing.

1B)  Maybe you don't even really have demanding computer needs or particularly important files on your computer.  Instead of buying a new PC, you might be better off with an tablet like an iPad or simple PC like a Chrome OS computer.

2)  If your current hardware is near and dear to your heart, you might prefer to upgrade the operating system instead of getting a new computer.  I really don't recommend this unless you know what you are doing.  Here you also have a few options. 

2A)  Buy a Windows Vista license, and upgrade to Vista.  Vista has the most straightforward upgrade path from XP and will preserve your programs and settings.  The cons here are that the license is expensive, VIsta is kinda crappy, and Vista's end of life is sooner rather than later, so this only buys you a couple of years.  It is however, possible to upgrade from windows Vista to Windows 7 directly, so this might be an OK stopgap.

2B) If your computer can handle windows 7 or windows 8, you can install those onto your computer to use instead of Windows XP.  If you upgrade from windows XP to either 7 or 8 (and I would recommend 8, might as well go with the most recent one), your documents will be moved to a folder on the main harddrive called windows_old.  You will have to reinstall all of your old programs but should not lose any data.  You should still backup your files though.  After the install, you wil need to manually move your old documents to right folders that you prefer.

2C)  Install Linux.  This is a whole other can of worms but has the main benefit of being totally free.  If you really want to try this, leave a comment and I will go over those options in a separate email.  However, the process is not too dissimilar to that of 2B, but you end up with Linux instead of windows on your computer. 

3.  Continue using your computer, but disconnect it from the internet.  This is not something I recommend, but it's better than nothing.

Wednesday, February 5, 2014

Simple model of snow accumation

In an effort to learn python and make a model of how quickly and how much snow accumulates, I decided to use python to build and display the results of a model I made up.

The problem:  The ground is generally warmer than snow, and snow will melt when it hits the ground unless it snows faster than the ground will melt it.  Thus this is a rate accumulation problem, where the rate of accumulation of the snow is equal to the rate of snow fall minus the rate of melting.  The one hitch to this model is that the rate of melting is inversely proportional itself to the amount of snow on the ground, but the rate of melting is zero when there is no snow to melt.

It took a little bit of thinking to come up with a mathematical function for the melting that has the properties that we need.  I came up with this.

s is the amount of snow, r_2 is determines the rate at which the snow melts when there is a lot of snow and c determines the rate at which the snow melts when there is very little snow.  This function let's us have a snow removal rate that decreases when the amount of snow increases, but does not explode into infinity when the snow total is zero.  Another way around this problem would have simply been to make the snow removal term r_2/s  and simply put some nonzero number as our initial snow condition, but that isn't reaslistic because there just isn't any snow when it's not snowing.

The next part of the model is the snow accumulation term.  I have no meteorological knowledge at all, so I naively make the assumption that snow typically starts off very lightly, gets worse until it hits a peak, and then tapers off.  So my function for the rate of snowfall was just a Gaussian curve (bell curve).

where sigma is the width of the curve (bigger sigma is a longer lasting storm), r_1 is the maximum rate of snowfall, and u is the time at which the snow fall is at it's peak.

We put these together for our differential equation

Which is a first order nonlinear differential equation of one variable.
Now the fun part, the python code

First we import the libraries we will need, which include the square root function, pi, and the exponential function.
We also import the functions needed to integrate the equation and plot the solution.

from math import sqrt, pi, exp
import matplotlib.pyplot as plt
from scipy.integrate import odeint
from numpy import linspace

Here we define the differential equation and the constants into a function called snowac

def snowac(s,t):
    #function to define the differential equaiton
    #for snow accumalation
    r1 = 10;  #inch/hour
    r2 = .01; #hours/inch
    sigma = 10
    u = 50
    c = .01
    return  r1*(1/(sigma*sqrt(2*pi)))*exp(-(t-u)**2/(2*sigma**2))-s*r2/(s+c)

Here we use odeint to solve the differential equation

tspan = linspace(0,200,10000)
initial_value = 0;
sol = odeint(snowac,initial_value,tspan)

Finally, we use plt to plot the solution.

The solution shows that the snow initially does not accumulate very much, then accumulates very quickly over a short period of time, and then slowly melts.

I have no idea how accurate this model actually is, but this seems reasonable.

Tuesday, January 21, 2014

Some of my favorite albums

These are the albums that I can basically always listen too no matter how many times I've listened.  This is not an exhaustive list and is not in any particular order.

Ghost Reveries - Opeth
This was not my favorite when I first heard it, but I found it improved a lot on multiple listens.  It has some really interesting compositions and typical Opeth heaviness.  Honestly, it was pretty hard to pick between all of the Opeth albums, I could have easily gone with Deliverance or Still Life.

Perpetual Burn - Jason Becker
A must have for any fan of instrumental hard rock.  It's nearly flawless with jaw dropping solos and beautiful melodies.

Number of the Beast - Iron Maiden
A metal classic, can't go wrong.

Paranoid - Black Sabbath
Again, a metal classic, nearly every song is amazing.

Normal - Bumblefoot
Probably the best combination of technical guitar playing and pop song writing ever made.

No Gravity - Kiko Loureiro
Instrumental metal with some latin twists.  Pretty awesome.

Black Light Syndrome - Bozio, Levin, Stevens
A mostly improvisational team up that is one of the more unique instrumental rock albums.

Friday, December 20, 2013

Install Octave with ODE45 for Mac

Octave instructions for Mac computers
I do not have access to a Mac computer so I cannot verify that this works, but I have researched the issue and this appears to be the most straightforward way to install Octave on the Mac.

  1. go to this link.
You will want to follow the instructions for setting up Octave with homebrew

  1. Install a program from Xcode.  If you have a recent Mac computer you can install Xcode from the Mac App store.  Unfortunately it is difficult to install Octave without Xcode installed.  There are instructions to do that here,  but they are not ideal for a novice.  If you have an older Mac and cannot access the Mac appstore, and do not feel comfortable with these alternative instructions, let me know and I will try to help.  If your computer is capable of upgrading to a version of Mac OS that has access to the Appstore, would make this process easier, but I do not recommend doing this because upgrades can cause their own problems, including data loss.

  1. if you made it this far is to install homebrew. The instructions are here, and you can visit this site to learn more, but there is really one step spotlight to find and open the terminal program.  Copy and paste this into the terminal and press enter
        ruby -e "$(curl -fsSL"

  1. After homebrew is installed, stay in the terminal (or reopen it) and type the following commands one by one, hitting enter after each.

brew tap homebrew/science
brew update && brew upgrade
brew install gfortran
brew install octave
Note: If brew complains about not having a formula for octave, the following command should fix it:
brew tap --repair
The command below upgrades Octave and its dependencies to the latest Homebrew-supported versions:
brew update && brew upgrade
Octave has many dependencies which will be downloaded and installed prior to Octave. The entire installation process can take a few hours. Note: On Snow Leopard, Octave requires a X server. If you install without, Homebrew will guide you to the XQuartz project ( where you can download this.   This can be installed in the usual way to install Mac programs
If you get errors about x11 environments, you might need to navigate to the file
to your octaverc file, normally located at the folder  /usr/local/share/octave/site/m/startup

Open this file with a text editor and add the line
setenv ("GNUTERM", "X11")

to the end of the file.

To add the Differential equation solvers:

Download the odepkg file from the course site and put it in the folder

Then start octave and type
pkg install odepkg-0.8.4.tar.gz

If this fails you might need to type
pkg install /usr/local/share/octave/odepkg-0.8.4.tar.gz

Set default folders.
Create a folder called modelingclass and put it in whatever folder you typically keep your personal documents.

  1. After you make the directory, add it to Octave path by typing
and pressing enter, while in the Octave window.
Then save this by typing
  1. savepath()

Create a launcher app with AppleScript
This will create a shortcut to start Octave,  otherwise you have to go to the terminal to run Octave each time.
Open the "AppleScript Editor" application
write the following text in the editor window:

tell application "Terminal"
do script "/path/to/octave; exit"
end tell
Select "Save as ..." from the "File" menu.  In the menu that appears, select "Application" from the "File format" menu, then navigate to the "Applications" folder and save your script there as ""