Wolfram|Alpha: A Computational Knowledge Engine

SEMINAR REPORT 2009-2011

In partial fulfillment of Requirements in Degree of Master of Technology In SOFTWARE ENGINEERING

SUBMITTED BY

NIDHI S

DEPARTMENT OF COMPUTER SCIENCE COCHIN UNIVERSITY OF SCIENCE AND TECHNOLOGY KOCHI – 682 022 COCHIN UNIVERSITY OF SCIENCE AND TECHNOLOGY KOCHI – 682 022

DEPARTMENT OF COMPUTER SCIENCE

CERTIFICATE

This is to certify that the seminar report entitled “Wolfram|Alpha: A

Computational Knowledge Engine” is being submitted by NIDHI S in partial fulfillment of the requirements for the award of M.Tech in Software

Engineering is a bonafide record of the seminar presented by her during the academic year 2009.

Dr.Sumam Mary Idicula Prof. Dr.K.Poulose Jacob Reader Director Dept. of Computer Science Dept. of Computer Science

ACKNOWLEDGEMENT

First of all let me thank our Director Prof: Dr. K. Paulose Jacob, Dept. of Computer Science, who provided with the necessary facilities and advice. I am also thankful to Dr. Sumam Mary Idicula, Reader, Dept. of Computer Science, for her valuable suggestions and support for the completion of this seminar. With great pleasure I remember Mr. G. Santhoskumar for his sincere guidance. Also I am thankful to all of my teaching and non-teaching staff in the department and my friends for extending their warm kindness and help.

I would like to thank my parents without their blessings and support I would not have been able to accomplish my goal. Finally, I thank the almighty for giving the guidance and blessings. Wolfram|Alpha: A Computational Knowledge Engine

Abstract

Wolfram Alpha is an answer engine developed by . It is an online service that answers factual queries directly by computing the answer from structured data, rather than providing a list of documents or web pages that might contain the answer as a search engine might. It was announced in March 2009 by , and was released to the public on May 15, 2009.

Wolfram Alpha is almost more of an engineering accomplishment than a scientific one — Wolfram has broken down the set of factual questions we might ask, and the computational models and data necessary for answering them, into basic building blocks — a kind of basic language for knowledge computing if you will. Then, with these building blocks in hand his system is able to compute with them — to break down questions into the basic building blocks and computations necessary to answer them, and then to actually build up computations and compute the answers on the fly.

Users submit queries and computation requests via a text field. Wolfram Alpha then computes and infers answers and relevant visualizations from a core knowledge base of curated, structured data. Alpha thus differs from semantic search engines, which index a large number of answers and then try to match the question to one

Wolfram Alpha is built on Wolfram's earlier flagship product, Mathematica, which encompasses computer algebra, symbolic and numerical computation, visualization, and statistics capabilities. With Mathematica running in the background, it is suited to answer mathematical questions. The answer usually presents a human- readable solution. CONTENTS

1. Introduction ------1

2. Goals ------2

3. How does Alpha works? ------3

4. Mathematica ------6

4.1. gridMathematica ------8 4.2. Features ------9 4.3. Interface ------10 4.4. High performance computing ------11 4.5. Development ------12 4.6. Connection with other applications ------12 4.7. Computable data ------15 4.8. Licensing ------15 4.9. Platform availability ------16 4.10.Support ------16

5. Wolfram Alpha API ------17

5.1. The “Query” API ------17 5.2. Basic of Wolfram Alpha output ------19

6. Five things Wolfram|Alpha does better than Google ------22

6.1. Complex queries ------22 6.2. Localization ------22 6.3. Precision ------22 6.4. Calculation ------23 6.5. Comparison ------23

7. Applications ------24

8. Future ------24

9. Conclusion ------25

10. Reference ------26 Wolfram|Alpha: A Computational Knowledge Engine

1. Introduction

Wolfram Alpha is an answer engine developed by Wolfram Research. It is an online service that answers factual queries directly by computing the answer from structured data, rather than providing a list of documents or web pages that might contain the answer as a search engine might. It was announced in March 2009 by Stephen Wolfram, and was released to the public on May 15, 2009.

Wolfram|Alpha's long-term goal is to make all systematic knowledge immediately computable and accessible to everyone. We aim to collect and curate all objective data; implement every known model, method, and algorithm; and make it possible to compute whatever can be computed about anything. Our goal is to build on the achievements of science and other systematizations of knowledge to provide a single source that can be relied on by everyone for definitive answers to factual queries.

When Wolfram Alpha was released to the public in May 2009, many people were surprised when it did not function like Google or any other search engine. The reason for this is that Wolfram Alpha is not a search engine, but a computational knowledge engine. Wolfram Alpha is far from perfect at this time, but it is already a tool that may find great use in the day-to-day work of the average college student and is sure to only get better with time.

Dept. Of Computer Science & Engg. ~ 1 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

2. Goals

Wolfram|Alpha's long-term goal is to make all systematic knowledge immediately computable and accessible to everyone. We aim to collect and curate all objective data; implement every known model, method, and algorithm; and make it possible to compute whatever can be computed about anything. Our goal is to build on the achievements of science and other systematizations of knowledge to provide a single source that can be relied on by everyone for definitive answers to factual queries.

Wolfram|Alpha aims to bring expert-level knowledge and capabilities to the broadest possible range of people—spanning all professions and education levels. Our goal is to accept completely free-form input, and to serve as a knowledge engine that generates powerful results and presents them with maximum clarity.

Wolfram|Alpha is an ambitious, long-term intellectual endeavor that we intend will deliver increasing capabilities over the years and decades to come. With a world-class team and participation from top outside experts in countless fields, our goal is to create something that will stand as a major milestone of 21st century intellectual achievement.

Dept. Of Computer Science & Engg. ~ 2 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

3. How does WolframAlpha work?

Wolfram Alpha is a system for computing the answers to questions. To accomplish this it uses built-in models of fields of knowledge, complete with data and algorithms that represent real-world knowledge. For example, it contains formal models of much of what we know about science -- massive amounts of data about various physical laws and properties, as well as data about the physical world.

Users submit queries and computation requests via a text field. Wolfram Alpha then computes and infers answers and relevant visualizations from a core knowledge base of curated, structured data. Alpha thus differs from semantic search engines, which index a large number of answers and then try to match the question to one.

Dept. Of Computer Science & Engg. ~ 3 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

Alpha has 4 major components:

 Data curation: Alpha doesn’t feed off the entire web but rather works off a managed database and certain trustworthy sources (Alexa and US Census info being among them). Data which does not change is managed and categorized whereas the sources are polled regularly for relevant, up-to-date information.

 Computation: 5-6 million lines of Mathematica spread across lots of parallel processors (10,000 in the production version) make up the heart of Alpha. They collectively encode a large segment of the algorithms and computer models known to man. They can be applied to theoretical problems (ie, integration, series creation, airflow simulation) or to specific data (weather prediction, tide forecasts etc).

 Linguistic components: The demonstration makes it clear that their is a very powerful (though far from perfect) natural language processing system at work. This freeform linguistic analysis is essential to Alpha because without it, a manual to make proper use of Alpha would be thousands of pages long (according to Wolfram).

 Presentation: Alpha is very pleasing to look at. The information is shown in a way that makes it very easy to get a good grasp of what’s being displayed but isn’t overwhelming at all. Though there is a standard overall format (individual data segments are arranged into ‘pods’ on the page), the actual displayed is very tailored to the specific query. It is actually simple enough for a child to use.

Alpha focuses on questions that have definite answers or that have answers that can be computed directly. In cases where there is confusion or dispute, or Alpha cannot compute sufficient answers, there will be the option of sidebar links to additional resources (like Wikipedia). Talking about Wikipedia, Alpha won’t be open for everyone to contribute to, however Wolfram said that there would be a smooth process for experts to contribute to Alpha’s knowledge base.

Dept. Of Computer Science & Engg. ~ 4 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

Mathematica has three crucial roles in Wolfram|Alpha. First, its very general symbolic language provides the framework in which all the diverse knowledge of Wolfram|Alpha is represented, and all its capabilities are implemented. Second, Mathematica's vast web of built-in algorithms provides the computational foundation that makes it even conceivably practical to implement the methods and models of so many fields. And finally, the strength of Mathematica as a software engineering and deployment platform makes it possible to take the technical achievements of Wolfram|Alpha and deliver them broadly and robustly.

Beyond Mathematica, another key to Wolfram|Alpha was NKS. Many specific ideas from NKS—particularly related to algorithms discovered by exploring the computational universe—are used in the implementation of Wolfram|Alpha. But still more important is that the very paradigm of NKS was crucial in imagining that Wolfram|Alpha might be possible.

Dept. Of Computer Science & Engg. ~ 5 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

4. Mathematica

Mathematica is a computational software program used in scientific, engineering, and mathematical fields and other areas of technical computing. It was originally conceived by Stephen Wolfram and is developed by Wolfram Research of Champaign, Illinois.

webMathematica is based on two standard Java technologies: Java Servlet and Java Server Pages (JSP) technologies. Servlets are special Java programs that run in a Java-enabled web server, which is typically called a "servlet container" (or sometimes a "servlet engine"). There are many different types of servlet container that will run on many different operating systems and architectures. They can also be integrated into other web servers, such as the Apache Web Server. webMathematica allows a site to deliver HTML pages that are enhanced by the addition of Mathematica commands. When a request is made for one of these pages the Mathematica commands are evaluated and the computed result is placed in the page. This is done with the standard Java templating mechanism, JavaServer Pages, making use of a special tags; examples of these are given in a later section. webMathematica technology uses the request/response standard followed by web servers. Input can come from HTML forms, applets, javascript, and web-enabled applications. It is also possible to send data files to a webMathematica server for processing. Output can be many different formats such as HTML, images, Mathematica notebooks, MathML, SVG, XML, PostScript, and PDF. This user guide includes examples of working with all these different technologies. webMathematica provides a large library of Mathematica commands to handle the many possible ways of working with Mathematica computations. An important part of webMathematica is the kernel manager which calls Mathematica in a robust, efficient, and secure manner. The manager maintains a pool of one or more Mathematica kernels and, in this way, can process more than one request at a time. An overview of the workings of a webMathematica site is shown below.

Dept. Of Computer Science & Engg. ~ 6 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

webMathematica adds interactive calculations and visualization to a web site by integrating Mathematica with thelatest web server technology. The diagram below shows a view of a webMathematica site, http://library.wolfram.com/explorations/webUnrisk/ index .html.

Dept. Of Computer Science & Engg. ~ 7 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

This site gives a web browser interface to financial calculations and visualizations that are driven by Mathematica. In this site users are taken through a sequence of web pages in which they select different input parameters and submit data to build up a sequence of results.

4.1 gridMathematica

gridMathematica increases the number of parallel processes that a Mathematica license can run, allowing the application of more CPUs to a task. A standard Mathematica license can run four parallel tasks, by running more some types of problems can be solved in less time.

Mathematica consists of three components: A front end, which provides the user interface, a controlling Mathematica process which includes which distributes tasks, and four Compute Kernels which take instruction from the Control Kernel and perform the distributed computations. gridMathematica provides additional Compute Kernels.

Dept. Of Computer Science & Engg. ~ 8 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

gridMathematica is available in two options: gridMathematica Local which adds 4 Compute Kernels to a single-machine license of Mathematica for use on a multi-core computer gridMathematica Server which provides 16 network based Compute Kernels and allows distribution of tasks over more than one computer.

Mathematica manages the inter process communication such as queuing, virtual shared memory, and failure recovery.

gridMathematica scales to larger grid systems with purchases of additional Compute Kernels. Worker processes can be located on a single multi processor computer or distributed over a remote heterogeneous network and includes 64bit platforms. The communication between the kernels and the front end uses the Mathlink interface, which is an interface designed to allow external programs to communicate with Mathematica. The communication is over TCP/IP and would use SSH or RSH for authentication.

4.2 Features

Features of Mathematica include:

 Elementary mathematical function library  Special mathematical function library  2D and 3D data and function visualization and animation tools  Matrix and data manipulation tools including support for sparse arrays  Solvers for systems of equations, Diophantine equations ODEs, PDEs, DAEs, DDEs and recurrence equations.  Numeric and symbolic tools for discrete and continuous calculus  Multivariate statistics libraries  Constrained and unconstrained local and global optimization  Programming language supporting procedural, functional and object oriented constructs  Toolkit for adding user interfaces to calculations and applications  Tools for image processing

Dept. Of Computer Science & Engg. ~ 9 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

 Tools for visualizing and analysing graphs  Tools for combinatoric problems  Data mining tools such as cluster analysis, sequence alignment and pattern matching  Number theory function library  Continuous and discrete integral transforms  Import and export filters for data, images, video, sound, CAD, GIS, document and biomedical formats  Database collection for mathematical, scientific, and socio-economic information  Support for complex number, arbitrary precision, interval arithmetic and symbolic computation  Notebook interface for review and re-use of previous inputs and outputs including graphics and text annotations  Technical word processing including formula editing and automated report generating  Tools for connecting to SQL, Java, .NET, C++, FORTRAN and http based systems  Tools for parallel programming

4.3 Interface

Mathematica is split into two parts, the "kernel" and the "front end". The kernel interprets expressions (Mathematica code) and returns result expressions.

The Mathematica Front End, designed by Theodore Gray, provides a GUI, which allows the creation and editing of Notebook documents that can contain program code with prettyprinting, formatted text together with results including typeset mathematics, graphics, GUI components, tables, and sounds. All contents and formatting can be generated algorithmically or interactively edited, and most standard word processing capabilities are supported but only one level of "undo" is supported.

Dept. Of Computer Science & Engg. ~ 10 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

Documents can be structured using a hierarchy of cells, which allow for outlining and sectioning of a document and support automatic numbering index creation. Documents can be presented in a slideshow environment for presentations. Notebooks and their contents are represented as Mathematica expressions that can be created, modified or analyzed by Mathematica programs. This allows conversion to other formats such as TeX or XML.

The Mathematica Front End includes development tools such as a debugger, input completion and automatic syntax coloring. The kernel and the front end communicate via the MathLink protocol. It is possible to use the kernel on one computer and the front end on another.

The standard Mathematica front-end is used by default, but alternative front-ends are available, including the Wolfram Workbench, an Eclipsebased IDE, introduced in 2006. It provides project-based code development tools for Mathematica, including revision management, debugging, profiling, and testing. Mathematica includes a command line front end.

4.4 HIGH PERFORMANCE COMPUTING

In recent years, the capabilities for high-performance computing have been extended with the introduction of packed arrays (version 4, 1999) , sparse matrices (version 5, 2003), and by adopting the GNU Multi-Precision Library to evaluate high- precision arithmetic.

Version 5.2 (2005) added automatic multi-threading when computations are performed on multi-core computers. This release included CPU specific optimized libraries. In addition Mathematica is supported by third party specialist acceleration hardware such as ClearSpeed.

Dept. Of Computer Science & Engg. ~ 11 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

In 2002, gridMathematica was introduced to allow user level parallel programming on heterogeneous clusters and multiprocessor systems and in 2008 parallel computing technology was included in all Mathematica licenses including support for grid technology such as Windows HPC Server 2008, Microsoft Compute Cluster Server and Sun Grid. Planned support for CUDA hardware was announced in 2008 but is still only provided by a third party add-on.

4.5 DEVELOPMENT

Several solutions are available for deploying applications written in Mathematica:

 Mathematica Player Pro is a runtime version of Mathematica that will run any Mathematica application but does not allow editing or creation of the code.  Mathematica Player is a free interactive player is provided for running Mathematica programs that have been digitally signed for non-commercial use via a Wolfram Research web service, or published on the Wolfram Demonstrations Project website. It can also view unsigned Mathematica files, but not run them.  webMathematica allows a web browser to act as a front end to a remote Mathematica server. It is designed to allow a user written application to be remotely accessed via a browser on any platform. It may not be used to give full access to Mathematica.

4.6 CONNECTIONS WITH OTHER APPLICATIONS

Communication with other applications occurs through a protocol called MathLink. It allows communication between the Mathematica kernel and front- end, and also provides a general interface between the kernel and other applications.

Although Mathematica has a large array of functionality, a number of interfaces to other software have been developed, for use where other programs have functionality that Mathematica does not provide, to enhance those applications, or to access legacy code.

Dept. Of Computer Science & Engg. ~ 12 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

Languages

 Wolfram Research freely distributes a developer kit for linking applications written in the C programming language to the Mathematica kernel through MathLink.  Using .NET/Link , a .NET program can ask Mathematica to perform computations; likewise, a Mathematica program can load .NETclasses, manipulate .NET objects and perform method calls. This makes it possible to build .NET graphical user interfaces from within Mathematica.  Similar functionality is achieved with J/Link., but with Java programs instead of .NET programs.  GUIKit allows the construction of custom interfaces to Mathematica using the Java Swing libraries.  Communication with SQL databases is achieved through built-in support for JDBC.  Mathematica can also install web services from a WSDL description.  MrMathematica allows people to call Mathematica from PLT Scheme.  Other languages that connect to Mathematica include Haskell and AppleScript.

Spreadsheets

 The OpenOffice.org office suite supports bi-directional access to Mathematica . Whilst OpenOffice.org is open-source and free, the add-on is commercial.  Microsoft Excel can call Mathematica via a commercial add-on.

Specialized Mathematical software

 MATLAB, which is another commercial mathematics program can be called from Mathematica, using freeware software written by Wolfram Research.  R, which is a programming language and development environment for statistical computing can be called from within Mathematica using a commercial interface.

Dept. Of Computer Science & Engg. ~ 13 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

 Sage, an open-source mathematics program can be called from within Mathematica. A Mathematica notebook is available for this.  The open-source special purpose computer algebra system SINGULAR can be called from within Mathematica.  MathModelica System Designer, modeling and simulation environment integrates with Mathematica  Mathematica can be called from Origin.

Mathematical equations can be exchanged with other computational or typesetting software as MathML.

Data acquisition

 Mathematica can link to LabView, which is a commercial program commonly used for data acquisition, and instrument control.  GPIB (IEEE 488) devices can be accessed via a free package GITM.  USB devices can be connected to Mathematica by use of a commercial add-on called BTopTools.  A free Mathematica package written for Mathematica 5.2 connects Mathematica to serial, parallel and USB devices can be found in the Wolfram Research library. Whether this works with Mathematica 6 or 7 would need to be tested.

Alternative Interfaces

 JMath is a third-party front end based on GNU readline that runs on UNIX-like operating systems.  MASH makes it possible to run self contained Mathematica programs (with arguments) from the UNIX command line

Dept. Of Computer Science & Engg. ~ 14 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

4.7 COMPUTABLE DATA

Mathematica includes collections of curated data in a consistent framework for immediate computation. Data can be accessed programmatically to inform or test models and is updated automatically from a data server at Wolfram Research. Some data such as share prices and weather are delivered in real-time. Data sets currently include:

 Astronomical data: 99 properties of 155,000 astronomical bodies  Chemical data: 111 properties of 34,000 chemical compounds, 86 properties of 118 chemical elements and 35 properties of 1000 subatomic particles  Geopolitical data: 225 properties of 237 countries and 14 properties of 160,000 cities around the world  Financial data: 71 historical and real-time properties of 186,000 shares and financial instruments  Mathematical data: 89 properties of 187 polyhedra, 258 properties of 3000 graphs, 63 properties of 6 knots, 37 properties of 21 lattice structures, 32 properties of 52 geodesic schemes  Language data: 37 properties of 149,000 English words. 26 additional language dictionaries  Biomedical data: 41 properties of all 40,000 human genes, 30 properties of 27,000 proteins  Weather data: live and historical measurements of 43 properties of 17,000 weather stations around the world

4.8 LICENSING

Mathematica is proprietary software restricted by both trade secret and copyright law. A regular single-user license for Mathematica used in a commercial environment costs between $2495 and $3120. It includes four additional kernels for parallel computations and one year of service that includes updates, technical support, a home use license, a webMathematica Amateur license, a Wolfram Workbench license and three Mathematica Player Pro licenses. Discounts are available for government, charity,

Dept. Of Computer Science & Engg. ~ 15 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine educational, pre-college, school, student, home use and retiree use and depend on geographical region. Student licenses cost $140. Educational site licenses allow use by students at home. A license manager similar to FLEXnet is available to provide sharing of licenses within a group.

4.9 PLATFORM AVAILABILITY

Mathematica 7 is supported on various versions of Linux, Apple's Mac OS X, NT- based Microsoft Windows, and Sun's Solaris platforms. All platforms are supported with 64-bit implementations.[42] Earlier versions of Mathematica up to 6.0.3 supported other operating systems, including AIX, Convex, HP-UX, IRIX,MS DOS, NeXTSTEP, OS/2, Ultrix and Windows Me.

The Mathematica Home Edition is a 32-bit application on Microsoft Windows. The Home Edition also runs on Linux and Mac OS X (Intel), but not Solaris (neither x86 nor SPARC). Whether there is a 32-bit limitation on Linux and Mac OS X for the Home Edition is not clear from the FAQ.

4.10 SUPPORT

Support via email is available to registered users by the emailing [email protected]. There is no official public support forum for professional users, although there is an official support forum for students. Posts are reviewed by a Wolfram Research moderator before they appear on the student forum.

MathGroup is a moderated email list and internet newsgroup comp.soft- sys.math.mathematica. It has more than 100,000 posts [45] and is the dominant public forum although it is not controlled by Wolfram Research. The moderator is Steve Christensen. Wolfram Research staff regularly answer questions on MathGroup. The posts are archived by Wolfram Research.

Dept. Of Computer Science & Engg. ~ 16 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

5. Wolfram Alpha API

The Wolfram|Alpha service provides a web-based API for clients to integrate the computational and presentation capabilities of Wolfram|Alpha into their own applications or web sites.

The API provides two general classes of queries. At the highest level, you can submit free-form queries like users might enter at the Wolfram|Alpha site itself, and get back full Wolfram|Alpha output in a variety of formats. The second type of query is a lower-level request for a single well-defined result, or range of results, from our entity/property-based data API, such as a caloric value for a food item, or a tide table for a requested location. These two API levels are quite different and are treated in separate sections below.

Both levels of the API are implemented in a standard REST protocol using HTTP GET requests. The result comes back as a descriptive XML structure wrapping the requested content format.

This is a preliminary document, and some details of the API may change before the API becomes available. New details and features will certainly be added, along with more extensive documentation and sample code. This document also does not deal with licensing considerations. Certain parts of the API or capabilities might not be available to all clients depending on licensing issues.

5.1 The “Query” API

The highest-level API is called the Query API because it allows callers to supply free-form natural language queries identical to what you would type into the Wolfram|Alpha web site itself. This high-level API lets callers retrieve full Wolfram|Alpha output in a variety of formats. The standard format is text and images, but you can also get HTML with CSS and JavaScript if you want the same formatting and behavior as on the Wolfram|Alpha site itself. This makes it very easy for clients to embed formatted Wolfram|Alpha output directly into their own web pages.

Dept. Of Computer Science & Engg. ~ 17 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

There are two functions in the Query API: query and validatequery. The query function is the main function, and it is accessed by a URL that begins with http://api.wolframalpha.com/v1/query. Its input and output are described in detail in the next few sections. In contrast, the validatequery function is a specialized function that performs only the initial parsing phase of Wolfram|Alpha processing. It can be used to quickly determine whether Wolfram|Alpha can make sense of a given input, bypassing the more time-consuming stages of fully analyzing the input and preparing results. The validatequery function is described in a later section.

Dept. Of Computer Science & Engg. ~ 18 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

5.2 Basics of Wolfram|Alpha Output

The output is divided into rectangular regions called pods, each of which corresponds roughly to one category of result. The output pictured below has five pods. Each pod has a title (“Input” is the title of the first pod), and content, which is typically a GIF image by default. Pods may also have additional features such as a copyable plaintext representation that appears in a popup when you mouse over the image, and JavaScript buttons that replace the pod with different information in an AJAX-style operation.

Pods have subpods that enclose the actual content. The pod titled "Alternative representation" in the screen shot has three subpods, each one showing a different mathematical identity for p. Each subpod is a separate result and a separate image on the page. By convention, every pod has at least one subpod, so pods that appear to show only one result have that result in a subpod.

On the Wolfram|Alpha site, the content of each subpod is generally an image. Most results have alternative formats, such as various forms of textual representation. Users of the API can request any combination of these different types of representations.

Output Formats

The Wolfram|Alpha API provides a number of formats in which results can be returned. You can request any combination of formats. The result of a call to the API is always an XML document, with each pod and/or subpod represented in one or more of the following formats.

Visual Representations

On the Wolfram|Alpha interactive web site, results are displayed in the form of GIF images. This allows mathematical formulas, tables, and of course graphics, to be formatted in a meaningful and attractive way. When using the Wolfram|Alpha API, you have two choices if you want such "pictures" of the output.

Dept. Of Computer Science & Engg. ~ 19 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

 Image: The "image" format gives you the same types of GIF images as seen on the Wolfram|Alpha site. Each subpod is returned as an HTML tag ready for direct inclusion in a web page.  HTML: Each pod is returned in the form of HTML, just as it is on the Wolfram|Alpha site itself. You also get HTML for the CSS and JavaScript inclusions necessary to make the output appear and behave like it does on the Wolfram|Alpha site.  PDF:Each subpod is returned as a URL to a PDF file.

Textual Representations

In some cases, you might not be satisfied with pictures of output, but will instead want some sort of structured textual representation of each subpod. You can then format it in a custom way, or pick it apart to extract only the desired piece. Not all results are available in all the formats listed below. For example, a plot of a mathematical function will have no plaintext representation, although it will have a Mathematica Input representation.

 Plaintext: This is the text format that you see in the "Copyable plaintext" popup that appears when you click on results on the Wolfram|Alpha site. It represents a simple "best guess" for a meaningful readable textual form of a given result. You will find it difficult, if not impossible, to write general-purpose code to analyze text in this format, so use it only if you want simple text to display to your users, or if you know the structure of the text in advance (e.g., it will be a number, or a latitide-longitude pair, etc.)  ‘Mathematica’ Input: This is the text format that you see in the "Mathematica plaintext input" popup that appears when you click on some results on the Wolfram|Alpha site. Mathematica is the computational engine that powers Wolfram|Alpha, and many results can be generated directly by single Mathematica input expressions. For example, the "Continued fraction" pod in the earlier Wolfram|Alpha screen shot for pi has a Mathematica input representation

Dept. Of Computer Science & Engg. ~ 20 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

of ContinuedFraction[Pi, 25]. Use this form if you want to feed the input into Mathematica, or use Mathematica as an environment for manipulating results.  ‘Mathematica’ Output: This is the text format that you see in the "Mathematica plaintext output" popup that appears when you click on some results on the Wolfram|Alpha site. Because all Wolfram|Alpha results exist in the form of Mathematica expressions before they are formatted, this format is available for all results, although it will sometimes be large (e.g., for mathematical plots), or not very useful (e.g., when the original source data is only available to Mathematica as a raster image, such as a country's flag). The first formula in the "Continued fraction" pod in the earlier Wolfram|Alpha screen shot for pi has a Mathematica output representation of {3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, 1}. Use this form if you want to feed the output into Mathematica, or use Mathematica as an environment for manipulating results.  MathML: Some Wolfram|Alpha results are mathematical expressions or formulas that require traditional math notation to look good (superscripts, fractions, integral signs, etc.) Presentation MathML (http://www.w3.org/Math) is a W3C standard XML format for mathematics. Many browsers can render MathML, perhaps with the assistance of a plug-in.  ExpressionML:ExpressionML(http://reference.wolfram.com/mathematica/ref/for mat/ExpressionML.html) provides a means to represent an arbitrary Mathematica expression in XML. There is a one-to-one correspondence between the ExpressionML representation and the Mathematica Output representation described above. Choose this format if you need to analyze or decompose the structure of results, and you prefer to use XML-based tools or libraries.  XML: Although ExpressionML is a structured XML representation of a result, it precisely represents the Mathematica output expression, and is more suitable for programmers who are familiar with Mathematica expression structure. For some types of results, such as tables, a more natural XML representation is also available. More details on this XML format are forthcoming.

Dept. Of Computer Science & Engg. ~ 21 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

6. FIVE THINGS WOLFRAM ALPHA DOES BETTER THAN GOOGLE

Wolfram alpha is not a search engine. Perhaps it will one day become one, but currently it’s exactly what its tagline says: a computational knowledge engine. However, it looks like Google, it provides you with answers and therefore most users will try to use it as a search engine, which doesn’t always yield good results. Once you start asking it the right questions, it’ll give you better answers.

Here are some guidelines which will help you shake off that “search engine” frame of mind and perhaps help you start using Wolfram Alpha to its full potential.

6.1 Complex queries

When you type a search query into Google, it understands what you want because the query is usually simple. If you give it a lot of data, it’ll get confused. Google searches, it doesn’t compute; and this is where Wolfram Alpha shines. It does not care at all how many arguments you give it; just like a calculator, it couldn’t care less if you’re adding up two or fifty numbers. That’s why concatenating many arguments in a query often works extremely well.

6.2 Localization

Google can create localized versions of its services, or even feed you different results depending on where you’re physically located. However, it cannot force every site out there to do the same. Wolfram Alpha, for the most part, does not depend on other sites for the data it’s giving you, and therefore its localization works better.

6.3 Precision

The first query most reviewers tried on Wolfram Alpha was typing their own name into it, and they’ve gotten lousy results. Well, that’s a good thing. Since you’re probably not in WA’s database, it does not try to pull the result from thin air; it simply

Dept. Of Computer Science & Engg. ~ 22 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine says it has no information on you. This makes Google vastly better for actually searching the web; but it also gives a certain advantage to Wolfram Alpha: it’s precise. You don’t have to worry about getting the wrong information; you can rely on Wolfram Alpha to either give you the right answer (depending, of course, on the accuracy of its own index), or no answer at all.

This can have important implications on the way we conduct searches. We’re used to approximate results, and thus we often try to round up numbers to get a better chance of finding an answer. On Wolfram Alpha, you can type in very precise queries, which can ultimately save you a lot of time.

6.4 Calculation

One way to think of Wolfram Alpha is as if someone collected all those various calculators scattered around the web and put them in one place. Google has been dabbling with this, adding currency conversion and other simple calculations to its search service, but WA is so vastly better than Google with this regard that you’ll actually use it in your everyday life.

6.5 Comparison

The Google frame of mind – or, shall we put it, the search engine frame of mind – forbids you to ask certain queries, because you know you will not get an answer. You probably wouldn’t even try to find a comparison of sales tax rates for five US cities, but on Wolfram Alpha it works like a charm.

Furthermore, when you need a comparison between two numbers or two data sets, you can only hope that Google has indexed a site that has exactly what you need; or you can do the comparing yourself. Not the case with WA, as you can easily compare several data samples and get not only results, but also handy graphs, ratios, tables and historical data comparisons.

Dept. Of Computer Science & Engg. ~ 23 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

7. Applications

 integrate Wolfram|Alpha into websites of any scale  use Wolfram|Alpha in online publishing  call Wolfram|Alpha from desktop applications  deploy Wolfram|Alpha on mobile or other devices  call on Wolfram|Alpha in cloud applications  rapidly develop interactive knowledge applications

8. Future

Wolfram|Alpha, as it exists today, is just the beginning. We have both short- and long-term plans to dramatically expand all aspects of Wolfram|Alpha, broadening and deepening our data, our computation, our linguistics, our presentation, and more.

Wolfram|Alpha is built on solid foundations. And as we go forward, we see more and more that can be made computable using the basic paradigms of Wolfram|Alpha— and a faster and faster path for development as we leverage the broad capabilities already in place.

Wolfram|Alpha was made possible in part by the achievements of Mathematica and A New Kind of Science (NKS). In their different ways, both of these point to far-reaching future opportunities for Wolfram|Alpha—whether a radically new kind of programming or the systematic automation of invention and discovery.

Wolfram|Alpha is being introduced first in the form of the .com website. But Wolfram|Alpha is really a technology and a platform that can be used and presented in many different ways. Among short-term plans are developer APIs, professional and corporate versions, custom versions for internal data, connections with other forms of content, and deployment on emerging mobile and other platforms.

Dept. Of Computer Science & Engg. ~ 24 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

9. CONCLUSION

The Wolfram Alpha knowledge engine is a fantastic tool for anyone who needs to perform serious calculations, or someone who wants to compute silly calculations. It is one of the most impressive systems that we have ever had, and it will prove to be a hugely valuable tool. One search query cuts out many of the calculations that you would have needed to do, and the graphs show you trends that could have taken a much longer time to figure out. Wolfram Alpha is a very impressive system.

Wolfram|Alpha is fun to play with, and introduces an original format for finding information on the Web. As it currently stands, it may be useful for mathematical and scientific research. However, until it aggregates a lot more data, and learns to handle more complex user queries, this interesting experiment is no danger to Google. In this case, David is lobbing equations at Goliath instead of stones -- which may be impressive, but certainly won't kill any giants.

Wolfram Alpha is on the cutting edge of search engine innovation. While it is not in direct competition with companies like Google and Yahoo, it can greatly enhance your web browsing experience. If you want a straight answer right away instead of having to sift through a long list of sometimes disreputable websites, Alpha is your go-to program.

Dept. Of Computer Science & Engg. ~ 25 ~ Cochin University of Science & Technology Wolfram|Alpha: A Computational Knowledge Engine

10. CONCLUSION

 http://www.wolframalpha.com/  http://www.wolfram.com/  http://www.howstuffworks.com/  http://en.wikipedia.org/wiki/Wolfram_alpha

Dept. Of Computer Science & Engg. ~ 26 ~ Cochin University of Science & Technology