Dark Matters
  • About Me
  • Publications
  • Educational Resources
  • Blog
  • Other Interests

Think Stats

2/27/2014

5 Comments

 
Picture
Last week, I finished plowing through Allen Downey's Think Stats. It took me about 5 days to work through it cover-to-cover. This book is great for those who need a crash course in using Python to do statistics. The conceit of the book is that it's a stats book for programmers. Hence, the statistics in it aren't past an upper-lever undergraduate level in difficulty. However, the programming required to work through the problems is at a higher level than I have seen in any other introductory stats book. I found it to be a great way to improve my Python programming. I worked through about 80% of the examples, skipping only those that were either trivial or did not seem relevant to my learning goals. For many of the examples, Downey provides .py files you can download from the book's website. I found that I usually took a different approach to solving problems than he did, but we most often agreed on the solutions. 

Anyway, the book is available as a free download and worth the time.

5 Comments

Follow-up on the IBM Ponder This 

3/11/2013

2 Comments

 
As I wrote a little while ago, I submitted a solution to IBM's Ponder this for February 2013. I was a bit of a pain in the butt since I first submitted an html file with no content. Oops. After sending the correct file, they reviewed it, and apparently my answer was suitable. You can see my name at the bottom of the webpage. Yay!
2 Comments

IBM Ponder This for February 2013

2/28/2013

0 Comments

 
Tonight, I decided to work on this month's Ponder This problem. It reads as follows:
James Tanton tweeted (https://twitter.com/jamestanton/status/293127359291330561) that "16 and 9 are each square numbers, and putting them together, 169, gives another square" and he then asked for other examples.

Our challenge this month is to find integers x, y, and z such that concatenating x^2 and y^2 gives z^2, and that z has at least four consecutive nines.

Update 2/6: the challenge stating that x,y and z should be non-zero.
The brute-force solution to this problem is pretty straightforward. I used Mathematica, but any programming language will work. In this program below, I generate lists of x^2 and y^2 values. I then convert those numbers to strings, concatenate the strings, convert those strings back into a number and check if the square root (z) is an integer. The (x,y,z) values that meet this condition are stored in the checkres list. To check is z contains more than four 9's, I convert z back into a string and look for any substring within z that contains four of more 9's. The (x,y,z) values that fit this criteria are stored in the results list.

The major hurdle in this problem is figuring out where in x-y parameter space to search. For x<1,000 and y<1,000, the are no more than two consecutive 9's and computing time starts to become an issue in Mathematica. For 1,000<x<10,000 and 1,000<y<10,000, there are three z values with three consecutive 9's. For a language such as Python or C++, the computing time would be significantly faster. I chose Mathematica for the ease of moving between data types.

I have not had much luck reducing the parameter space for viable solutions. Below is the brute force Mathematica code to show solutions with two or more consecutive 9's. The x or y value is at least 5 digits. I found some reliable ways of general solutions with three consecutive 9's, but the four 9 solutions were elusive for longer than I care to admit. 
Picture
After looking at it for a while longer, I found that numbers of the form x=49999... and y=99999.... will produce an increaseing string of 9's in z when their squares are concatenated. Here are the solutions for four through eleven 9's. I'm sure there are solutions I am missing, but I believe this solves the problem as stated. 
Picture
Update: IBM has since posted an algebraic solution to this problem. They have not yet reviewed my solution since I accidentally sent them the wrong file at first.
0 Comments

    Archives

    July 2015
    February 2014
    November 2013
    October 2013
    September 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013

    Categories

    All
    Arduino
    Chess
    Lightsaber
    Math
    Probability
    Projects
    Python
    Raspberry Pi
    Robotics
    Statistics

    The Great Arduino Project

    RSS Feed

Powered by Create your own unique website with customizable templates.