Wolfram|Alpha Blog http://blog.wolframalpha.com Mon, 22 Sep 2014 16:54:16 +0000 en-US hourly 1 http://wordpress.org/?v=3.4.2 Scorpion on CBS http://blog.wolframalpha.com/2014/09/19/scorpion-on-cbs/ http://blog.wolframalpha.com/2014/09/19/scorpion-on-cbs/#comments Fri, 19 Sep 2014 16:02:55 +0000 The Wolfram|Alpha Team http://blog.internal.wolframalpha.com/?p=28703 Ever wondered what someone with an IQ higher than Einstein’s and a penchant for hacking into NASA might be capable of? If so, you’re in luck. CBS will air the pilot for its brand new series Scorpion, and Wolfram|Alpha will be live-tweeting it this Monday, September 22, at 9/8c. This highly anticipated premiere, starring Elyes Gabel and Katharine McPhee, kicks off a thrilling action drama about a group of super-geniuses brought together by Walter O’Brien to act as the last line of defense in a series of complex threats arising in the modern world. The Scorpion team are taking the next step in proving that the contemporary superhero’s best accessory isn’t a cape, but a laptop.

Scorpion on CBS

Our live-tweets will feature facts, queries, and commentary about the show. We’ll take a look at things like the math behind siphoning electricity and insightful statistics based on character names. We’re happy to see another installment in the good fight for the nerd revolution and can’t wait to watch as a bunch of brainiacs save the world. Join us for a night of science and suspense and send us your own Wolfram|Alpha Scorpion queries to @wolfram_alpha!

http://blog.wolframalpha.com/2014/09/19/scorpion-on-cbs/feed/ 0
Introducing Tweet-a-Program http://blog.wolframalpha.com/2014/09/18/introducing-tweet-a-program/ http://blog.wolframalpha.com/2014/09/18/introducing-tweet-a-program/#comments Thu, 18 Sep 2014 21:29:09 +0000 Stephen Wolfram http://blog.internal.wolframalpha.com/?p=28779 In the Wolfram Language a little code can go a long way. And to use that fact to let everyone have some fun, today we’re introducing Tweet-a-Program.

Compose a tweet-length Wolfram Language program, and tweet it to @WolframTaP. Our Twitter bot will run your program in the Wolfram Cloud and tweet back the result.

Hello World from Tweet-a-Program: GeoGraphics[Text[Style["Hello!",150]],GeoRange->"World"]

One can do a lot with Wolfram Language programs that fit in a tweet. Like here’s a 78-character program that generates a color cube made of spheres:


It’s easy to make interesting patterns:


Here’s a 44-character program that seems to express itself like an executable poem:


Going even shorter, here’s a little “fractal hack”, in just 36 characters:


Putting in some math makes it easy to get all sorts of elaborate structures and patterns:



You don’t have to make pictures. Here, for instance, are the first 1000 digits of π, sized according to their magnitudes (notice that run of 9s!):


The Wolfram Language not only knows how to compute π, as well as a zillion other algorithms; it also has a huge amount of built-in knowledge about the real world. So right in the language, you can talk about movies or countries or chemicals or whatever. And here’s a 78-character program that makes a collage of the flags of Europe, sized according to country population:


We can make this even shorter if we use some free-form natural language in the program. In a typical Wolfram notebook interface, you do this using CTRL + =, but in Tweet-a-Program, you can do it just using =[...]:

ImageCollage[=[Europe populations]->=[Europe flags]]
ImageCollage[=[Europe populations]->=[Europe flags]]

The Wolfram Language knows a lot about geography. Here’s a program that makes a “powers of 10” sequence of disks, centered on the Eiffel Tower:

Table[GeoGraphics[GeoDisk[=[Eiffel Tower],Quantity[10^(n+1),"Meters"]],GeoProjection->"Bonne"],{n,6}]
Table[GeoGraphics[GeoDisk[=[Eiffel Tower],Quantity[10^(n+1),"Meters"]],GeoProjection->"Bonne"],{n,6}]

There are many, many kinds of real-world knowledge built into the Wolfram Language, including some pretty obscure ones. Here’s a map of all the shipwrecks it knows in the Atlantic:

GeoListPlot[GeoEntities[=[Atlantic Ocean],"Shipwreck"]]
GeoListPlot[GeoEntities[=[Atlantic Ocean],"Shipwreck"]]

The Wolfram Language deals with images too. Here’s a program that gets images of the planets, then randomly scrambles their colors to give them a more exotic look:


Here’s an image of me, repeatedly edge-detected:

NestList[EdgeDetect,=[Stephen Wolfram image],5]
NestList[EdgeDetect,=[Stephen Wolfram image],5]

Or, for something more “pop culture” (and ready for image analysis etc.), here’s an array of random movie posters:


The Wolfram Language does really well with words and text too. Like here’s a program that generates an “infographic” showing the relative frequencies of first letters for words in English and in Spanish:


And here—just fitting in a tweet—is a program that computes a smoothed estimate of the frequencies of “Alice” and “Queen” going through the text of Alice in Wonderland:


Networks are good fodder for Tweet-a-Program too. Like here’s a program that generates a sequence of networks:


And here—just below the tweet length limit—is a program that generates a random cloud of polyhedra:


What’s the shortest “interesting program” in the Wolfram Language?

In some languages, it might be a “quine”—a program that outputs its own code. But in the Wolfram Language, quines are completely trivial. Since everything is symbolic, all it takes to make a quine is a single character:


Using the built-in knowledge in the Wolfram Language, you can make some very short programs with interesting output. Like here’s a 15-character program that generates an image from built-in data about knots:


Some short programs are very easy to understand:


It’s fun to make short “mystery” programs. What’s this one doing?


Or this one?


Or, much more challengingly, this one:


I’ve actually spent many years of my life studying short programs and what they do—and building up a whole science of the computational universe, described in my big book A New Kind of Science. It all started more than three decades ago—with a computer experiment that I can now do with just a single tweet:


My all-time favorite discovery is tweetable too:


If you go out searching in the computational universe, it’s easy to find all sorts of amazing things:


An ultimate question is whether somewhere out there in the computational universe there is a program that represents our whole physical universe. And is that program short enough to be tweetable in the Wolfram Language?

But regardless of this, we already know that the Wolfram Language lets us write amazing tweetable programs about an incredible diversity of things. It’s taken more than a quarter of a century to build the huge tower of knowledge and automation that’s now in the Wolfram Language. But this richness is what makes it possible to express so much in the space of a tweet.

In the past, only ordinary human languages were rich enough to be meaningfully used for tweeting. But what’s exciting now is that it seems like the Wolfram Language has passed a kind of threshold of general expressiveness that lets it, too, be meaningfully tweetable. For like ordinary human languages, it can talk about all sorts of things, and represent all sorts of ideas. But there’s also something else about it: unlike ordinary human languages, everything in it always has a precisely defined meaning—and what you write is not just readable, but also runnable.

Tweets in an ordinary human language are (presumably) intended to have some effect on the mind of whoever reads them. But the effect may be different on different minds, and it’s usually hard to know exactly what it is. But tweets in the Wolfram Language have a well-defined effect—which you see when they’re run.

It’s interesting to compare the Wolfram Language to ordinary human languages. An ordinary language, like English, has a few tens of thousands of reasonably common “built-in” words, excluding proper names etc. The Wolfram Language has about 5000 built-in named objects, excluding constructs like entities specified by proper names.

And one thing that’s important about the Wolfram Language—that it shares with ordinary human languages—is that it’s not only writable by humans, but also readable by them. There’s vocabulary to acquire, and there are a few principles to learn—but it doesn’t take long before, as a human, one can start to understand typical Wolfram Language programs.

Sometimes it’s fairly easy to give at least a rough translation (or “explanation”) of a Wolfram Language program in ordinary human language. But it’s very common for a Wolfram Language program to express something that’s quite difficult to communicate—at least at all succinctly—in ordinary human language. And inevitably this means that there are things that are easy to think about in the Wolfram Language, but difficult to think about in ordinary human language.

Just like with an ordinary language, there are language arts for the Wolfram Language. There’s reading and comprehension. And there’s writing and composition. Always with lots of ways to express something, but now with a precise notion of correctness, as well as all sorts of measures like speed of execution.

And like with ordinary human language, there’s also the matter of elegance. One can look at both meaning and presentation. And one can think of distilling the essence of things to create a kind of “code poetry”.

When I first came up with Tweet-a-Program it seemed mostly like a neat hack. But what I’ve realized is that it’s actually a window into a new kind of expression—and a form of communication that humans and computers can share.

Of course, it’s also intended to be fun. And certainly for me there’s great satisfaction in creating a tiny, elegant gem of a program that produces something amazing.

And now I’m excited to see what everyone will do with it. What kinds of things will be created? What popular “code postcards” will there be? Who will be inspired to code? What puzzles will be posed and solved? What competitions will be defined and won? And what great code artists and code poets will emerge?

Now that we have tweetable programs, let’s go find what’s possible…

To develop and test programs for Tweet-a-Program, you can log in free to the Wolfram Programming Cloud, or use any other Wolfram Language system, on the desktop or in the cloud. Check out some details here.

To comment, please visit the copy of this post at the Wolfram Blog »

http://blog.wolframalpha.com/2014/09/18/introducing-tweet-a-program/feed/ 0
Launching Today: Mathematica Online! http://blog.wolframalpha.com/2014/09/15/launching-today-mathematica-online/ http://blog.wolframalpha.com/2014/09/15/launching-today-mathematica-online/#comments Mon, 15 Sep 2014 19:20:44 +0000 Stephen Wolfram http://blog.internal.wolframalpha.com/?p=28730 It’s been many years in the making, and today I’m excited to announce the launch of Mathematica Online: a version of Mathematica that operates completely in the cloud—and is accessible just through any modern web browser.

In the past, using Mathematica has always involved first installing software on your computer. But as of today that’s no longer true. Instead, all you have to do is point a web browser at Mathematica Online, then log in, and immediately you can start to use Mathematica—with zero configuration.

Here’s what it looks like:

Click to open in Mathematica Online (you will need to log in or create a free account)

It’s a notebook interface, just like on the desktop. You interactively build up a computable document, mixing text, code, graphics, and so on—with inputs you can immediately run, hierarchies of cells, and even things like Manipulate. It’s taken a lot of effort, but we’ve been able to implement almost all the major features of the standard Mathematica notebook interface purely in a web browser—extending CDF (Computable Document Format) to the cloud.

There are some tradeoffs of course. For example, Manipulate can’t be as zippy in the cloud as it is on the desktop, because it has to run across the network. But because its Cloud CDF interface is running directly in the web browser, it can immediately be embedded in any web page, without any plugin, like right here:

Another huge feature of Mathematica Online is that because your files are stored in the cloud, you can immediately access them from anywhere. You can also easily collaborate: all you have to do is set permissions on the files so your collaborators can access them. Or, for example, in a class, a professor can create notebooks in the cloud that are set so each student gets their own active copy to work with—that they can then email or share back to the professor.

And since Mathematica Online runs purely through a web browser, it immediately works on mobile devices too. Even better, there’s soon going to be a Wolfram Cloud app that provides a native interface to Mathematica Online, both on tablets like the iPad, and on phones:

Wolfram Cloud app: native interface to Mathematica Online

There are lots of great things about Mathematica Online. There are also lots of great things about traditional desktop Mathematica. And I, for one, expect routinely to use both of them.

They fit together really well. Because from Mathematica Online there’s a single button that “peels off” a notebook to run on the desktop. And within desktop Mathematica, you can seamlessly access notebooks and other files that are stored in the cloud.

If you have desktop Mathematica installed on your machine, by all means use it. But get Mathematica Online too (which is easy to do—through Premier Service Plus for individuals, or a site license add-on). And then use the Wolfram Cloud to store your files, so you can access and compute with them from anywhere with Mathematica Online. And so you can also immediately share them with anyone you want.

Share access easily from Mathematica Online

By the way, when you run notebooks in the cloud, there are some extra web-related features you get—like being able to embed inside a notebook other web pages, or videos, or actually absolutely any HTML code.

Mathematica Online is initially set up to run—and store content—in our main Wolfram Cloud. But it’ll soon also be possible to get a Wolfram Private Cloud—so you operate entirely in your own infrastructure, and for example let people in your organization access Mathematica Online without ever using the public web.

A few weeks ago we launched the Wolfram Programming Cloud—our very first full product based on the Wolfram Language, and Wolfram Cloud technology. Mathematica Online is our second product based on this technology stack.

The Wolfram Programming Cloud is focused on creating deployable cloud software. Mathematica Online is instead focused on providing a lightweight web-based version of the traditional Mathematica experience. Over the next few months, we’re going to be releasing a sequence of other products based on the same technology stack, including the Wolfram Discovery Platform (providing unlimited access to the Wolfram Knowledgebase for R&D) and the Wolfram Data Science Platform (providing a complete data-source-to-reports data science workflow).

One of my goals since the beginning of Mathematica more than a quarter century ago has been to make the system as widely accessible as possible. And it’s exciting today to be able to take another major new step in that direction—making Mathematica immediately accessible to anyone with a web browser.

There’ll be many applications. From allowing remote access for existing Mathematica users. To supporting mobile workers. To making it easy to administer Mathematica for project-based users, or on public-access computers. As well as providing a smooth new workflow for group collaboration and for digital classrooms.

But for me right now it’s just so neat to be able to see all the power of Mathematica immediately accessible through a plain old web browser—on a computer or even a phone.

And all you need do is go to the Mathematica Online website

To comment, please visit the copy of this post at the Wolfram Blog »

http://blog.wolframalpha.com/2014/09/15/launching-today-mathematica-online/feed/ 0
The Alpha Albums Contest: Pygmalion Edition http://blog.wolframalpha.com/2014/09/02/the-alpha-albums-contest-pygmalion-edition/ http://blog.wolframalpha.com/2014/09/02/the-alpha-albums-contest-pygmalion-edition/#comments Tue, 02 Sep 2014 14:04:56 +0000 The Wolfram|Alpha Team http://blog.internal.wolframalpha.com/?p=28592 This year, Wolfram is excited to be sponsoring the tenth anniversary of the annual Pygmalion Music Festival, which takes place in our hometown of Champaign–Urbana. If you aren’t familiar with Pygmalion, it’s a music festival held locally that brings together incredible musical artists, authors, and vendors in one amazing weekend. Of course, the music is always the focus, and to really get behind that, we’ve got a great way to interact with fans of both math and music.

We’re bringing back our Alpha Albums contest with new song lyrics (collected in collaboration with LyricFind) from some of the bands that will be featured at this year’s festival! What that means is that we take albums from the artists, enter a word cloud query request in Wolfram|Alpha for that album, and post the generated image in a tweet. From there, all you loyal fans will have one hour to submit your guesses via Twitter in an @-reply; at the end of the submission period, we will choose a random winner from the correct entries.

Last Splash word cloud

We know it will be mighty tempting to cheat the system and try to search the lyrics online, but we’re hoping that everyone will play nice and keep the competition fair. Here are a few helpful hints to get you started:

  • The largest words, closest to the center, appear most frequently on the album. Common words like “and,” “or,” etc., are removed by default.
  • Look for unusual words that might tip you off to specific songs, like “cannonball” in the word cloud pictured above (from Last Splash by The Breeders).

So what’s in it for you? Our lucky winners will receive three free months of Wolfram|Alpha Pro!

And as an added bonus for those of you attending Pygmalion, Wolfram will have a booth at the festival on Saturday and Sunday where you can participate in a live version of this contest. Fans who correctly guess the word clouds on display at the booth will have the opportunity to win posters of the word clouds! The grand prize winner will have his or her poster autographed by one of the headliners!

The contest goes live tomorrow at 1pm CDT and will be held every Wednesday running up to the first day of the festival, Thursday, September 25. Good luck!

For a full list of Alpha Albums contest rules, visit Official Rules for the Wolfram|Alpha® Alpha Albums Contest. Let us know your thoughts in the comments or on Twitter, and have a great time!

http://blog.wolframalpha.com/2014/09/02/the-alpha-albums-contest-pygmalion-edition/feed/ 1
A Year in a Chemistry Developer’s Shoes http://blog.wolframalpha.com/2014/08/28/a-year-in-a-chemistry-developers-shoes/ http://blog.wolframalpha.com/2014/08/28/a-year-in-a-chemistry-developers-shoes/#comments Thu, 28 Aug 2014 14:51:46 +0000 Tal Einav http://blog.internal.wolframalpha.com/?p=28510 .KeyEvent { font-family: Verdana, Arial, sans-serif; margin-right: 1px; padding: 1px 2px; background: #f6f6f6; border: 1px solid #ccc; font-size: 11px; line-height: 14px; display: inline !important; } .KeyEventDelimiter { font-family: Verdana, Arial, sans-serif; color: #5c5c5c; }

I have always seen the beauty of chemistry from a scientific standpoint: strange shapes, eye-catching patterns, giant explosions… But it was not until I came to Wolfram|Alpha that I began to appreciate just how sleek chemistry is from a programming perspective. Just a few lines of code are needed to create some of the most startling phenomena and give life to elegant theories.


In Wolfram|Alpha, some property values are stored in a database and are called non-computed properties; the remaining properties are called computed properties because they are calculated from the non-computed properties. MoleculePlot is a computed property, and so generating the above plot takes a bit more than one line of code (internally, the main function takes roughly 1,000 lines of code). Yet even if you restrict yourself to non-computed properties, you can create such diagrams with very little code. Here is a basic diagram of acetic acid from non-computed properties compared to the computed property CHBlackStructureDiagram.

Basic versus fancy diagram

Of course, this code is bare bones: it cannot display ions or isotopes, it will squish large molecules, and it does not have color. Nevertheless, for a few lines of code, it does a surprisingly good job.

To give you some perspective, in this past year I added 35,000 lines of code and modified an existing 30,000 lines of code. Much of it went into creating new functionality such as our periodic table (200 lines of code). The beauty of this periodic table lies not only in its new color scheme (which matches Mathematica 10′s color scheme, and can be seen through the command ColorData[97]), but also in the pull-down menu featuring neat properties such as boiling point, electronegativity, and the year each atom was discovered.

Periodic table

A lot of work went into upgrading our framework so that when you query for properties such as MoleculePlot or CHBlackStructureDiagram, the result comes back quickly and efficiently. Sometimes the renovations are quick and simple, such as showing as much data as possible (20 lines of code); sometimes it requires completely re-thinking how we handle objects such as chemical reactions (5,000 lines of code and a lot of thought).

While it is fantastic to find an answer to your query, it is even better to understand the procedure used to get to that answer. One of the most exciting new directions we took this year was to expand our Step-by-step functionality into chemistry.

Step-by-step Lewis structure

While computing ATP’s MoleculePlot above may be an intricate task, writing these Step-by-steps can quickly become breathtakingly complicated. As with all of Wolfram|Alpha, the steps are written using Mathematica, which means it is up to the developer to program the grammatical structure. As you might imagine, this can cause what appears to be a very basic sentence to be much more complicated under the hood. Let’s take a basic example: the second step lists the number of valence electrons in the chemical. There can be one, two, or three or more types of atoms—each of which requires different grammatical syntax. Additionally, other clauses may be stuck in the beginning, middle, or end of the sentence to describe special cases (e.g. for chemicals with a nonzero net charge), each of which requires support for punctuation, capitalization, and grammar.

So far, so simple. But to do a really great job, the steps have to vary their diction, intelligently short-circuit to the answer whenever possible, and generally sound human. We want for you to think of Wolfram|Alpha as your best friend, not only ready to answer your questions, but also to explain how she arrived at her answers.

All this would be tricky, but still straightforward, if it were not for all of the crazy exceptions that abound in chemistry! For practically every rule you can think of involving molecular bonding, there is an exception out there (as you learn from your first chemistry course); with over 40,000 molecules in our database, you can test any hypothesis and immediately find counter-examples. As the steps progress, they can branch off into an incredible number of different paths. It’s a thrilling ride to construct such an algorithm in a cogent and coherent pattern (not to mention generating robust tests for both calculation errors and grammatical inconsistencies)!

That is what made creating the Lewis structure Step-by-step such an exciting experience, especially after I discovered that the standard procedure to draw Lewis structures fails for many molecules in our database. Ultimately, the end product was a very robust Step-by-step that accounts for all ChemicalData entities. (For full disclosure: the steps do not work for 3-center 2-electron bonds or 3-center 4-electron bonds, such as in diborane or bifluoride. Therefore, the steps can handle all of our chemicals except 2.)

To give some perspective, simply drawing the Lewis dot structure diagrams took 200 lines of code; the Step-by-step took 1,000 lines of code.

User feedback was very positive for this first Step-by-step, prompting us to expand the functionality to other areas of chemistry. We decided to first tackle the most popular chemistry queries in Wolfram|Alpha, aiming primarily at important topics someone would learn in an introductory chemistry course. In addition, the Step-by-steps should fit together and complement one another. Creating the Lewis structure Step-by-step naturally suggested calculating oxidation states. We also wanted to break into chemical reactions: balancing chemical reactions begot computing reaction stoichiometry, which begot converting between units, which begot preparing solutions.

We tried to make each Step-by-step encompass as wide a field as possible. For example, the stoichiometry Step-by-step will calculate the theoretical yield of products if only given amounts for reactants (e.g. 2 grams glucose + oxygen -> water + carbon dioxide), will calculate the percentage yield of products if given amounts of reactants and products (e.g. 0.2 mol CH4 + O2 -> 7 mL H2O + CO2), and will calculate the amount of reactants needed if only given amounts of products (e.g. C6H6 + NO2+ -> 0.02 mols C6H5NO2 + H+). We plan to continue expanding to other areas, and user feedback always helps us prioritize what to tackle next!

For users who want to get into the driver’s seat, Wolfram|Alpha’s tighter integration into Mathematica 10 grants mouth-watering access to our chemistry data (along with element, isotope, and thermodynamic data). We exposed over 50 new properties and gave the remaining properties a serious tune-up, including upgrading to the new Version 10 formats for Quantity, Entity, and Association!

Both new and experienced users should check out the ChemicalData documentation page where all the chemistry functionality is explained along with numerous examples on how they can be used. Once you are ready and eager to access the data, we recommend using the Ctrl+= interface to discover entities and properties. For example, typing “benzene” into this interface will yield the right-hand side of:


Alternatively, you can peruse our entire list of chemicals. Here’s a random sample of five entities.

Random sample of five entities

Each entity has a list of properties that you can query. The full list is rather large, so let’s just focus in on properties that begin with the letter M.

Properties that begin with letter M

You can now use ChemicalData to perform an entity-property query and to access the data for each of these properties

ChemicalData entity-property query

You can use free-form input to discover a specific entity-property query directly by typing it into the Ctrl+= interface. For example, typing in “benzene molar mass” yields a ChemicalData expression that you can evaluate to find the molar mass.

Benzene molar mass

Because this interface links directly to Wolfram|Alpha, it grants you significant flexibility on how you enter your input. For example, you can alter the order of the input (“molar mass benzene”), insert filler words (“what is the molar mass of benzene”), use generic phrases (“benzene mass”), misspell words (“benzne masss”), and so much more. Wolfram|Alpha has got your back!

With that introduction, you have all the tools to play around in various fields of chemistry. For example, you can do a systematic study of your favorite molecule—let’s pick cyclobutane. One of the important features of cyclobutane is its bonding structure, so let’s consider the chemicals whose graphs are isomorphic to cyclobutane’s along with their boiling points and molar masses.


Here we find both the general trend that boiling point increases with molar mass as well as the (expected?) exceptions—the chemicals in the first and third slots. This invites a series of questions: Do fluorocarbons like octafluorocyclobutane always have a significantly lower boiling point than their hydrocarbon counterparts? Is fluorine special, or would the same phenomenon happen with other halogens? Could we make a program that can predict a molecule’s boiling point based on its structure diagram? There are countless directions to go!

The combination of Mathematica and Wolfram|Alpha transforms chemistry into an incredibly fun subject to explore. What amazing things can you create once you have the right tools for the job? We have worked to make chemistry not just intellectually stimulating and visually appealing, but a truly sexy aspect of the Wolfram Language. As we continue expanding Wolfram|Alpha’s capabilities, we welcome your recommendations. Share your thoughts on how to make chemistry even more beautiful, suggest what future directions you would like us to delve into, or simply shout out to the world that you love Wolfram|Alpha!

http://blog.wolframalpha.com/2014/08/28/a-year-in-a-chemistry-developers-shoes/feed/ 0