WolframAlpha Programming Cloud

WolframAlpha released it's programming cloud last month. Here are my attempts at playing with it.

You can list the largest cities in any country, for example, by issuing the following command -
CityData[Large, "India"]

Which by itself isn't particularly useful, but the CityData also contains geoLocation data so you can then map the largest cities on a country Shape by using the Graphics command -
Graphics[{Gray, CountryData["India", "Polygon"], PointSize[Large], Red, Tooltip[Point[Reverse[CityData[#,"Coordinates"]]],CityData[#,"Name"]] &/@CityData[{Large,"India"}]}]

In the example above, I've imported the India Shapefile using the CountryData directive, colored it Gray, applied large red dots to indicate the large cities within the map and used the Tooltip directive to pop-up city names on mouse-over.

Then I went one better and applied population densities to the dots using - 
Graphics[{Gray, CountryData["India", "Polygon"],Opacity[0.3, Red], Tooltip[Disk[Reverse[CityData[#, "Coordinates"]],Log[10.^9, QuantityMagnitude[CityData[#, "Population"]]]] ,CityData[#,"Name"]]& /@CityData[{Large, "India"}]}]



The red background indicates an error. I don't think it's the equation but the data that's generating an error. My guess is that one of the city co-ordinates is off the map. The population densities are calculated on a logarithmic scale and the density of color is applied accordingly. The reverse directive reverses the order of the key-value pairs, the # indicates an input, the & indicates the function that is to be executed (the first part of the statement and the /@ indicates that the following data needs to be applied to the function. 

Or you could just plot a graph - 




You can also do other silly things such as create a Target logo -



Create a crescent moon on a green background (I was trying to make the Pakistani flag) -


Graph a star - 



Or chart the weather in NYC for the past couple of weeks. The charts below are for rainfall, barometric pressure and min and max temperatures respectively. -



If you're have the full WolframAlpha/Mathematica desktop app you can find clever things about the subway system (the following screenshot is from one of the examples) -



Comments

Popular posts from this blog

The Forecaster Brown Fan Club

How to Create a Pentaho Report Using the REST Client

Automated Testing with vncdotool (Not Headless, but Hairless)