Mathematica 10

Things I particularly like about Mathematica 10.

1. Multiple undo

It undoes both the typing and the results of one’s typing. Yay.

2. Curated APIs

Mathematica can now natively communicate with a number of online services, tweeting or analyzing one’s tweets, downloading images from instagram, making association graphs of one’s facebook friends, and so forth.

I have in the back of my mind to set up an IP camera that Mathematica monitors, and that tweets when it detects specified activities. It would take only about three lines of code.

In practice, so far, I’ve been using it mostly with RunKeeper.

runkeeper = ServiceConnect["RunKeeper", "New"];
ServiceExecute[runkeeper, "UserData"];
id = First[runkeeper["FitnessActivities"]]["ActivityID"];

runkeeper["AnimatedPathMap", {"ActivityID" -> id,
AnimationRunning -> False}]


The major weaknesses here are (a) not every service that Wolfram connects to publishes the information that you want via their API. So, for example, while there is the great FriendNetwork from Facebook and FollowsNetwork from Twitter, there is nothing comparable from LinkedIn. Further, sometimes the service does make information available but Mathematica gives you no way to query it. For example, the RunKeeper connection would be about a million times more useful to me if I could pull HRM data as well as the geopath. RunKeeper can provide it, but Mathematica 10 doesn’t know how to ask. Perhaps if enough of us complain about its abence, Wolfram will respond.

3. Associations

One could create structured lists before, but this is vastly more flexible. Instead of

{name, age, street address}

where the form is rigid and can be confusing especially for long records with mostly blank entries, and where the form must be carefully documented for there will be any hope of reusing the data or the code that interpreted it, one can now do

In[59]:= item1 = <|name -> "bill smith", age -> 37, streetAddress -> "121 Main Street"|>;

In[60]:= Lookup[item1, name]

Out[60]= "bill smith"

In[66]:= addressbook = {<|name -> "bill smith", age -> 37,
streetAddress -> "121 Main Street"|>, <|name -> "susan smith",
streetAddress -> "121 Main Street"|>};

In[67]:= Map[Lookup[#, name] &, addressbook]

Out[67]= {"bill smith", "susan smith"}

One can also combine elements from multiple associations into a single record, something that would have been more difficult with the old method.

4. Wolfram Cloud deployment

This is not as good for Manipulate[] as the Mathematica plugin, but far more accessible.

In[8]:= CloudDeploy[
runkeeper["AnimatedPathMap", {"ActivityID" -> id, AnimationRunning -> True}],
Permissions -> "Public"]

Out[8]= CloudObject["\

Other thoughts

Templating and, in particular, automated report generation, would have been useful in my last job. I’m not sure about this one but it feels as though it may come in handy.

Wolfram has improved support for the standardized time series datatype that they introduced in, I think, version 9. I’ve been using a homegrown method since long ago and the Wolfram version is lacking a lot of functionality still (the ability to do math between time series, dividing one by another, for example. The ability to normalize a time series, etc.). Together with the ability to manipulate metainformation (introduced in version 9), this is now a clean way of handling financial information. I expect to start migrating my code over to use the new format.