**Step 1:** Open Chrome, and google for some images. Then open up the javascript console from the Develop Menu (or press Command+J), which look like this:

**Step 2:** Scroll down until you've paged through as many images you'd like (we can only download those images that the browser loads).

**Step 3:** Paste the following line into the console and press return.

// Include jQuery in the JavaScript Console var script = document.createElement('script'); script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"; document.getElementsByTagName('head')[0].appendChild(script);

**Step 4**: and wait a few seconds for script to load, then run this:

// grab them var urls = $('.rg_di .rg_meta').map(function() { return JSON.parse($(this).text()).ou; }); // write to file var textToSave = urls.toArray().join('\n'); var hiddenElement = document.createElement('a'); hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave); hiddenElement.target = '_blank'; hiddenElement.download = 'myFile.txt'; hiddenElement.click();

Now the file of urls is in your Downloads folder, hope that helps someone!

]]>The Boids algorithm was an artificial life program developed by Craig Reynolds in 1986 to model flocking behavior of birds. Complicated behaviors emerge from only a few simple rules:

**separation**: steer to avoid crowding local flockmates**alignment**: steer towards the average heading of local flockmates**cohesion**: steer to move toward the average position (center of mass) of local flockmates

Basically, each boid considers all other boids within a set distance to be part of its flock, adjusting its own velocity to both match that of flock members in its cone of vision and attempting to avoid collisions.

]]>This awesome automaton both generates and displays the primes!

]]>** Pairs of Isomorphic Graphs**

Determining if two graphs are isomorphic is a mysterious problem, in that it is conjectured to lie somewhere in the space between NP-complete and P, *possibly separating them, *and thus deciding P vs NP. Now, for planar graphs a polynomial algorithm is known (Hopcroft 1973) when the maximum degree is bounded by a constant. In some sense, the graph isomorphism problem is easy except for a tiny sliver set of irreducibly complex graphs, and these pathological subsets are what make graph problems difficult.

Recently, Laszlo Babai at the University of Chicago has claimed an astounding theorem, that the Graph Isomorphism problem can be solved in quasipolynomial time. He didn’t get a polynomial time algorithm, but he got something quite close, which is exciting!

]]>#define echo(_X_) do{\ __typeof__(_X_) _Y_ = (_X_);\ const char * _TYPE_CODE_ = @encode(__typeof__(_X_));\ NSString *_STR_ = VTPG_DDToStringFromTypeAndValue(_TYPE_CODE_, &_Y_);\ if(_STR_)\ MBLog(@"%s = %@", #_X_, _STR_);\ else\ MBLog(@"Unknown _TYPE_CODE_: %s for expression %s in function %s, file %s, line %d", _TYPE_CODE_, #_X_, __func__, __FILE__, __LINE__);\ }while(0)]]>

Theo gray of Touch press

Me and jesse freedman programming A Hypnocube

I thought that the best talk of the conference was Theo Gray's presentation of the story behind the Disney Animated project, winner of Apple's Best App of 2013 Award. Theo illuminated the struggles of implementation with great clarity and a wonderfully dry sense of humor. The biggest algorithmic hurdle was accurately replicating the ice crystal visualizations from the movie Frozen. It was hard to dynamically draw those snowflakes in real time on a mobile device when their rendering took multiple minutes on a supercomputer.

Being the CEO of one of the most successful app companies is no small potatoes, and so I stalked him down and talked shop afterwards. We chatted about his first block buster app "The Elements" and he joked that he had made more money in a day than his entire career at Wolfram. When developing the Elements, Theo was not to bothered with the overly ceremonious Core Data framework, nor did he build objective-c delegation towers of babel! Their Xcode project used merely a .plist key-value store for persistence and prerecorded movies for interactive transitions!

Visualization of Valles Marineri - the MAriner Valley on Mars

On the last day of the conference I decided to submit an entry for the infamous One-Liner programming competition. My first attempt was to construct a classic 3d graphic - the *Mathematica* 6 styled Surface-Textured Hyperbolic Dodecahedron. But with only 128 characters, it wasn't a piece of cake. I wound up trying something a bit more fun instead: downloading interesting data files from NASA and rendering 3D scenes though which I animated the camera viewpoint along B-splines to render movies. A little while after tweeting my program I received a text message from a friend at the company saying that I won - my "Mar's Flyby" submission was in first place, followed by a second place program that I helped write, with my other entry "Gödel Escher Batman" rounding out the top three prize. Here's a night-time perspective of what I made in 128 characters:

But in a dramatic turn of events, a mere 15 minutes before the award ceremony, a minor glitch in the front-end of my notebook was noticed. A tiny error message displayed on one of the judge's screens disqualified my wining entry! Now, everyone knows that the front-end of *Mathematica* has been somewhat seditiously unstable since version 6 was released. But that is a small price to pay for the power of dynamic notebooks - awesome functionality originally unveiled by Steve Jobs and Theo at WWDC 2005. This glitch is an easy bug to fix but I had submitted it and didn't check my email after that. Alas I didn't win first place but at least I still took home a Raspberry Pi. For more on the winning entries check out Chris Carlson's 2014 one-liner competition blog post.

**The Positives**

- Multiple Undo
- Improvements to Evaluation Abortion
- Associations & Dataset
- Computational Geometry
- Basic Machine Learning
- Unit Testing

Mathematica 10 brings a new powerful data type to the language, *Associations*. These are analogous to dictionaries in Python or Julia since they consist of key-value pairs but more robust, allowing for valuable MapReduce patterns. **Dataset[]** will be very useful once it can handle importing database tables with foreign keys, until then, not so much.

Version 10 also adds broad support for geometric computation, with the key element being that of geometric regions. Geometric regions can be created by using special regions such as circles, using formulas, using meshes containing collections of simple regions, or combining other regions through Boolean combinations and transformations. Several standard properties can be directly computed for every region, such as membership tests, measure (e.g. length, area, volume), centroid, nearest points, etc. Regions can also be used as specifications for many high-level solvers, including optimization, algebraic equation solving, integration, and partial differential equation solving.

**The Negatives**

- No support for some key modern OSX features (ehem, scrollbars?)
- Remaining lack of stability in the Frond End
- Cloud Deploy API Functions are weak, restrictive, and brittle
- Still no full implementation Risch Integration
- Classifier and Predictor functions not exportable
- No updates to RLink
- No updates to parallel programming or CUDA/OpenCL functions
- No updates to Compile or C code generation
- Social Networking Data and FinancialData are both broken
- "Mathematica > Wolfram Language" rebranding (a global search & replace)

One of Mathematica’s competitors, Maple, had a new release recently which saw the inclusion of a set of fractal exploration functions. Version 10 parrots this, but functions that plot standard fractals are not high on anyone's feature request list.

My concerns center around the data and Stephen Wolfram’s comment ‘basic versions of Mathematica 10 are just set up for small-scale data access.’ What does this mean? What are the limitations and will this lead to serious users having to purchase add-ons that would effectively be data-toolboxes, and what exactly is the Data Science Platform and how much will it cost?

Background - For four years I worked with Stephen Wolfram, the youngest Ph.D. that Caltech ever produced, building a Computable Knowledge Engine (the first of its kind) at the Harvard-based Special Projects group of Wolfram Research. If you are interested in Wolfram, I suggest you check out the Wolfram Science Summer School and the Mathematica Summer Camps. I was an instructor at both in past years and I highly recommend them for students of all fields.

]]>The MITX What’s Next Awards is a showcase of the best of the best in digital and innovation in New England. Since 1996, the MITX Awards have grown to become one of the largest and most prestigious awards competitions in the country for marketing innovations, as well as creative and technological accomplishments.

We've also shot up to the top 50 productivity apps of the App Store:

Background - In 2013 I joined the founding team of Boston-based private social network software startup Mustbin. We built a new ultra-secure platform for organizing your most vital information and treasured moments. At Mustbin I lead the R&D efforts with the team of inspired developers and designers responsible for building the Mustbin platform. After our launch in November we had a number of articles written about in media outlets such as Techcrunch, Xconomy, etc.. My favorite is this article from China. To find out more about the project, watch the explainer video below (but be careful, the theme is catchy). Currently we're building out the platform to include Android and Desktop clients.

]]>Here is the code:

*There is no other system in the world you can do this kind of stuff in this fast. None.*

But at the core of their tech is a very simple idea, the Optimal Recognition Point - the best point in a word for your eyes to look at. This heuristic is easy to learn and so I was able to code my own version of spritz in a few lines of mathematica code.

]]>In case you didn't know, I love data visualization. The dendrogram is one of my favs - it's a tree diagram frequently used to illustrate the arrangement of the hierarchies. Dendrograms are often used in computational biology to illustrate the clustering of genes or samples (figure on right). But as with any tree diagram, they can quickly become unwieldy. I study graphs often enough that I've developed some nifty little utilities for viewing them. One of my favorite from an aesthetic point of view is above on the left. With just a tiny bit of math, dendrograms can be transformed into an arguably more palatable polar form.

Tree Plot

polar dendrogram

But what if the tree is very large and you want to be able to inspect the clustering structure of weighted leaves? For this, polar tree maps are handy. Here's an example - the two diagrams on the right are different views of the exact same underlying tree structure.

If you have a Mac, check out the app DaisyDisk - an extremely useful disk usage analysis tool and tour-de-force showcase for polar tree maps. Indeed, with different color schemes they can become interactive pieces of modern art!

]]>

To use GAPLink simply download and compile the GAP core system (run $./configure and then $make). Then download my notebook, insert the appropriate path to the gap.sh shell script found in the bin directory of the folder where you installed GAP, and finally run the notebook and establish the link (you must have java installed). To be sure the connection is established properly, execute the cell that runs the testall.g file (which should take about 30 seconds to complete).

With GAPLink you can vastly extend Mathematica's limited group theory functionality. Here are some of the groups Mathematica already knows about:

I've included basic functions for translation of datatypes like GAPCycles, GAPGroup, and GroupPropertyQ. For example, with the latter function you can use GAP's internal algorithms for computing subgroup counts, detect supersolvable groups, or even compute when a group is polycyclic. Here are some property computations via GAP on the dihedral group of order 16:

I find this tool immensely useful and until Mathematica's interoperability is brought into the 21st century it's the only way to go, enjoy!

]]>A *cardioid* is a plane curve traced by a point on the perimeter of a circle that is rolling around a fixed circle of the same radius. The typical technique for constructing them is by complex equations, but here is another technique for producing the pattern that only use simple straight lines.

Choose some small angle, say θ = 3° and a natural number n > 1. Draw the line segments joining the points on the unit circle with coordinates {Cos[r θ], Sin[r θ]} and {Cos[n r θ], Sin[n r θ]} for all 0 < r < k (where k depends on n). A cardioid appears (each of the straight lines is tangent to a cardioid) and is called the *envelope *of the family of straight lines. Here is the code.

I find computer-science fictional interfaces e.g. alien clocks, rather exquisite. The timepiece above is a favorite of mine. The countdown graphic is displayed on the villain's tri-lithium missile launching platform in the movie Star Trek Generations. A number of fun blogs have surfaced recently that catalogue and explore various sci-ware interfaces from movies. Here's a few good ones: fakeui, access, movie code. Anyways, I had a free hour so I went and coded up an iPhone app for a clock that tells time in a user supplied base.

If you've never heard of a binary clock it's really simple. The example above on the right is counting seconds from 12:01 to 12:02. Here the columns correspond to the six decimal numbers h, h, m, m, s, s in base two (from left to right). Now, sadly the c-source would never fit into one small blog post and in the end, hundreds of lines of code were needed - lo the inelegance of the Objective-C language. But functional languages allow for breathtaking brevity, instead of over 100 lines, we use under 100 characters! Here's that 1-liner:

This generates the binary clock above on the left (rows are h, m, s in binary from top to bottom). Of course, this isn't deployable code, yet... In future versions of Mathematica, as it is strongly typed, the kernel may be able to use clang to transform the expression into proper objective-c for iOS deployment (but that's just my pipe-dream).

]]>Last year at the Wolfram Technology Conference in Illinois the participants were invited to join a friendly coding competition. The challenge this time was to write a program that would make an Egg-Bot would print (in less than 15 minutes) the most interesting design possible, thus giving attendees a chance to exercise their graphics skills. I always liked the patterns that differencing polygons would create. With a single line of code I was able to explore this space of intricate motifs, (a sample of which is shown below on the left). After mapping a few of these into spherical coordinates you get the following 2nd place entry on the right.

Manipulate[ Graphics[Polygon[Table[r^n {-Sin[n*a], Cos[n*a]}, {n, 0, L}]], PlotRange -> P], {P, 1, 0}, {{r, .98}, 1, .95}, {{a, 2.6}, 0, 2 Pi}, {{L, 300}, 1, 1000, 1}]]]>

However, we can side step the problem and achieve similarly graceful behaviors with highly symmetric starting configurations. For example, if the starting positions of the points are vertex locations of the unit distance Golomb graph (shown on the left) then what we see the mesmerizing ballet on the right

All edges are length 1

We can do the same simulation of particles in three dimensions. Starting with an anti-prism on the left the vertices weave beautifully patterned orbits if we visualize them over time.

Starting with random positions and random masses will show random behaviors that are still interesting in a modern art sense if not platonically beautiful. Get the code.

]]>Victorian mathematician-philosopher William Kingdon Clifford wrote ‘It is wrong, always, everywhere and for any one, to believe anything upon insufficient evidence.’ In 1996 professor Alan David Sokal would revive this principle and defend the Left from a trendy segment of itself.

Currently a professor of mathematics at University College London as well as a professor of physics at NYU, Sokal works in statistical mechanics and algebraic graph theory (which incidentally overlaps with some my graduate work). He is best known to the wider public for his criticism of postmodernism, and 1996 after years of being troubled by an apparent decline in the intellectual rigor of the American academic humanities he decided to do an experiment:

**Would a leading North American journal of cultural studies publish an article liberally salted with nonsense if (a) it sounded good and (b) it flattered the editors' ideological preconceptions? **

Absolutely! The then-non-peer-reviewed postmodern cultural studies journal Social Text by Duke University Press published his submission *Transgressing the Boundaries: Toward a Transformative Hermeneutics of Quantum Gravity*. That this grand-sounding paper was hoax would be revealed years later in the journal *Lingua Franca. *

Sokal gained immense publicity after the fallout of his nonsense paper was published. His critique would also gain more credibility from encompassing his own community: the failure of scientific institutions to address the abuse of statistical methods or promote systematic reviews is no less of a threat to progress than the ramblings of postmodernists or fundamentalists.

The one flaw I mentioned in the above mathematics paper is just that, it is nonsense. The paper was generated by computer using similar methods to Sokal, text data mining other papers on the arCHIv.

]]>The 3D analogue of the Julia set fractal is the **quaternion fractal**. Since it is rather hard to draw 4 dimensional objects, one needs a way of rendering 4D quaternion fractals onto a 2D screen. The approach used here is to intersect the 4D solid with a plane. In essence, this makes one of the quaternion components dependent upon the other three. To get a feel for the true nature of the quaternion fractal one needs create a whole series of slices along an axis perpendicular to the slice plane. This is the same as what one does when drawing contour lines to visualize a landscape, where each contour represents a slice of the landscape by a plane perpendicular to the vertical axis. By "stacking" the contours together we gain an appreciation of the surface. Unfortunately, in the case of a 4D object we need to stack 3D solid objects along a 4th axis, which is a little more difficult for our limited 3D visual system. The animation above shows the 3D slices as the cutting plane moves along one of the quaternion axes. Get the code