Wolfram Research

portrait WW CookAuthor Note: This article is evolving, as I learn more about Wolfram Research (the company), the Wolfram Language (the language used to program the concepts of the designer), Wolfram Mathematica (the first product and the latest and ever improving product that incorporates all other concepts from all the other Wolfram products), and Wolfram|Alpha (a platform to allow anyone to access a huge and growing database of information, developed by Stephen Wolfram and Wolfram Research). One more product exist, the Wolfram Programming Lab, I know very little about this product, but will be finding out more as I explore. This is a fun project to learn about what the various products can do. Even though Wolfram Mathematica is the initial product of Wolfram Research, I have found that it is the main environment in which all major Wolfram Language coding and development is done.

Table of Contents

History

Wolfram Research was founded “by Stephen Wolfram in 1987, Wolfram Research is one of the world’s most respected computer, web, and cloud software companies.” The first product that Wolfram Research produced was Mathematica in 1988. Coding in Mathematica is done in the Wolfram Language. The Language “defines a unique convergence of computation and knowledge.” The Language has developed enough that it has its own webpage for teaching all that can be done using the language itself. Mathematica has developed enough that it allows “free-form” input as well as Wolfram Language input. The “free-form” input made typing natural language queries easy. This made not knowing the Language less of a problem for those who wanted to access Wolfram’s (and the internet’s) large data collection. Eventually, this was popular enough that Wolfram Research developed a new product, Wolfram|Alpha, that allows casual users to enter simple queries and receive quite complete answers.

Wolfram|Alpha

The initial screen allows you to explore various examples. It has an input line at the top and a listing of all the major areas that the examples cover below. The examples are very easy to follow. Usually the example pages have the orange outlines input boxes. The input boxes store the examples. To execute any example, just press the equal (=) sign at the end of the input box. This appears to show the results of queries based on the Wolfram Language, but does not delve into the language itself. The input will accept a natural language quesry as well as a Wolfram Language command. I have included a separate section on the Wolfram Language. Quoting from Stephen Wolfram’s book An Elementary Introduction to the Wolfram Language, it depends on what you need on whether you need to use Wolftram|Alpha or the Wolfram Language:

“For the quick question-answering of Wolfram|Alpha, its enough just to say in plain English what you want. But if youre going to do more systematic tasks, you need a way to explain them precisely. And thats what the Wolfram Language is for.”

The Wolfram|Alpha product includes downloadable components and a very tight integration with the Cloud. This allows better sharing of projects between remote sights working on the same problems.  the cloud data repository and web or local platform helps researchers and students explore areas and concepts in a general overview or a very detailed way. As I do various problems, I will put my results here. The basic platform is free to all users. There is a Pro version that in May 2016 could be purchased for $65.88/year. You can also purchase it monthly at a slightly higher fee.

It is good to just go through and experiment. One of my favorite examples is:

Morse code “Wolfram Alpha”

The results, as anyone who has gone through scouting would know, is:

Wolfram Alpha in Morse Code

Wolfram Alpha in Morse Code

I have included the full output, so that you will have a better idea of the appearance of the Wolfram|Alpha environment. There will often be information at the top and to the right of the output. Stephen Wolfram is the person on the left of the picture. The actual code is:

Actual resulting Morse Code

Actual resulting Morse Code

Difference Between Standard and Pro Versions

The way the difference was explained to me was the difference between a professional or teacher version and a student version. The Standard Version is available free at http://www.wolframalpha.com/. The Pro version is not too expensive, and educators receive a discount. The Pro version currently has two features, which will soon be added to the student version. These are being able to expand the solution to see the step by step solution to a stated problem (I have the Pro version so some the examples that follow include the Step-By-Step solutions) and sample problem generation. The ability to create test problems is still reserved for the teacher. Tests are generated in PDF format.

Support

For me, support is one of the biggest issues with many large companies. Since I am a PRO user, I expect the PRO features to work. Last night, I reported the issue. By this morning, a representative was in touch with me. By this afternoon, the issue was resolved. Way to go, this speaks highly of the people who support the products.

Word Problems and Algebra

I have taught Algebra at the junior high school, senior high school, and college levels. The most common problems students have are with word problems. Therefore, that is the first example area I explored. For simple problems, it works great. I did find I had to choose my verbiage carefully to have the problems solved. It is interesting to see what is understood and what is not understood. The first time I went through the examples, I found a section called “Word Problems.” I have to look a bit harder, because I have not been able to find it since then. The following table is for what I currently can find. When I used the Word Problem examples, the “I have 9 balls minus 1 ball” was solved correctly. The input line may be sensitive to which module is selected, in order to put a higher priority on the know algorithms to solve that particular type of problem.

Input Understood
9-1 Yes
9 minus 1 is what? Yes
9 balls minus 1 ball is what? Yes
nine balls minus one ball is what? Yes
9 balls minus 1 ball is what? Yes
I have 9 balls minus 1 ball No
Input interpretation:
I have 9 balls. I have -1 balls.
I have 9 minus 1 balls Yes
Input Interpretations:
I have 8 balls
 48t+52t=200, solve for t Yes
Input interpretation:
solve 48 t+52 t = 200 for t
Result:
Step-by-step solution
t = 2
Plot:
trainGraph

The “48t+52t=200, solve for t” example is based on two trains traveling toward each other at given speeds, when will they meet.  I am satisfied with what Wolfram Alpha can do in this area. Since there are so many other interesting features Wolfram Alpha has, I will go explore other aspects of the environment.

People and History

Wolfram|Alpha has a large database about history and historic figures. I probably could spend too much time in this area, so I will only cover it briefly. To see how it works, I put in the family name for a person well known by his title in English history:

Input Answer
>Q: Who are John Lackland’s children? The second question has to do with cousins and how many times removed. Input interpretation:
John of England | children
Result:
King Henry III | Isabella of England |
Joan of England, Queen of Scotland | Eleanor of Leicester |
Richard, 1st Earl of Cornwall | Joan, Lady of Wales
2nd cousin three times removed Input interpretation:
genealogical relation | second cousin 3 times removed
Genealogical tree:
2nd cousin 3x removed

It also told me his siblings and parents as well as the fact that he was the first King of England to sign the Magna Carta. Impressive.

Wolfram Mathematics

Wolfram Mathematica is the first product that Wolfram Research Developed. It is also the latest product, incorporating the use of the Wolfram Language and the free-form input of Wolfram|Alpha.

The beauty about the mathematics input is that it can be written using a real language, along with simple or complex mathematics. I like that it understands terms like “differentiate” and “integrate between.” Wolfram Mathematica does provide ways to input the proper mathematical expressions, which will become easier with a better understanding of the environment and language. In Mathematica, it provides the Wolfram Language translation for every “real language” input entered. When I first started telling friends I am exploring Wolfram Mathematica, he said that he uses Wolfram|Alpha extensively when teaching his children various areas of mathematics. He especially likes the translation of English into proper mathematics formulas, with analysis and graphs added. For example, for formula:

derivative of (3x^4-2x^2-3) sin x/2

produces the output (which is much clearer if you go to Wolfram|Alpha and type in the equation. I did break up the output into two sections to make it a bit better.

First part of the differential equation output

First part of the differential equation output

and part 2

Second part of differential equation output

Second part of differential equation output

An integration example is as follows. I did learn that the value has to come before the “between” phrase in the formula to get it to interpret the line the way I expected it to be.

integrate the value 4x^2 +3x -1 between 4 and 10

the output is:

Integration equation output

Integration equation output

If you notice, there is a Step by Step description for solving the equation. Since this problem has the limits of x going from 4 to 10, Wolfram determines that it can be solved either without the limits (indefinite) or with the limits. It gives you the option to view either. The first shown is the Indefinite Integral Solution:

Indefinite Integral solution step by step

Indefinite Integral solution step by step

The second is the Definite Integral Solution. Since it is a bit longer, it is divided into two parts.

Definite Integral Step by Step (first group)

Definite Integral Step by Step (Group 1)

Definite Integral Solution Step by Step (Group 2)

Definite Integral Solution Step by Step (Group 2)

The graphs can also be created for three variable (dimension) equations.  As the coefficients of each of the variables change the shape of the graph will change from a sphere to more of an ovoid (three-dimensional oval).  I will include three graphs, a sphere (all dimension coefficients are the same), an ovoid (where the coefficients are different), and a funnel (where one of the coefficients is negative.

graph 2x^2 + 2y^2 + 2z^2 = 16
Sphere graph

Sphere graph

graph 6x^2 + 2y^2 +8z^2 = 16
Ovoid Graph

Ovoid Graph

graph 2x^2 - 4y^2 + 6z^2 = 64
Funnel shaped graph

Funnel shaped graph

Physics

This is a great place to learn the basics of Physics. Physics is “Phun” and this deserves more research after I go through more of the Wolfram Language Tutorial. Typing in something simple, like:

Newton's first law application

gives the results:

Newton's First Law results

Newton’s First Law results

Picture Analysis

Another feature of Wolfram|Alpha is the Picture Analysis tool. It is fun to go through and see what analysis is being done to the picture. You can see how modifying color, brightness, sharpness, etc. can change the picture effects. Here are five picture analyses and one picture sharpness adjustment. Initially, the PDF writer wrote additional information over each table. Go to the real analysis pages, and you will see options to download data underneath these two tables. The PDF writers (Microsoft and Quicken) I have did not know how to handle these options. A good PDF editor removed them, so they are all clean on my home system. Browse history is having a problem with the Corn example. I have cleared browser history and the correct page is now being displayed. The Wolfram|Alpha photograph analysis page has a plethora of additional information than what is available in these PDF files.

To give an idea of the information Wolfram|Alpha has about each picture, I have included the tables here. . The first is the camera used, the exposure time,  and the time and date the picture was taken. It is amazing the amount of additional information that is stored with digital pictures that was not stored with slides:

Wolfram|Alpha Image Characteristics, telling details about the details of the picture.

Wolfram|Alpha Image Characteristics, describing the details of the picture being displayed.

Wolfram|Alpha image source information that is overwritten in the PDF file

General Questions

General Questions can be asked of Wolfram|Alpha. For example, I was curious what happened on this date (May 24) in 1968. I typed: “What happened on this date in 1968?” and got the results.

What happened on this date (May 24) in 1968?

What happened on this date (May 24) in 1968?

One suggestion that one of the trainers at Wolfram made was to ask odd questions that make the students think about the problem. One of the examples he gave was comparing the amount of energy produced by the Trinity Bomb test to the amount of energy needed to prepare a meal. The next example was to find out how many meals each person in the United States could receive for the same amount of energy. If it is hard to read, the input line is: (yield of the Trinity bomb)/(calories in a Big Mac). The nice thing is that Wolfram|Alpha knows how to interpret “common knowledge: like the “Trinity bomb” and a “Big Mac.”

Comparing the energy output of the Trinity bomb vs the amount of energy used to cook a slow roasted turkey

Comparing the energy output of the Trinity bomb vs the amount of energy used to cook a slow roasted turkey

Stephen Wolfram wrote a book A New Kind of Science. It appears that an on-line version of this book is available with the PRO package. According to Stephen Wolfram, people tried to explain the complexities of nature through traditional mathematics.  A classic example is the Greek’s use of the Golden Rectangle with a ratio of sides of 1:1.618. This was used heavily in Greek architecture and can be found in natural designs, such as the Logarithmic spiral found in snail and nautilus shells. Simple patterns can make complex designs. From this basis, Stephen Wolfram ran an experiment running several simple computer programs in a sequence to see what the results would be. Even though the programs were simple, the results were far more complex. This was the basis of the Wolfram Language and Mathematica. This work can be applied to many fields, but for this example we will strictly look at Physics. Over the last two hundred years, Physicists have been breaking down the fundamental concepts of physics into simple rules that can be easily tested and measured. The beauty of what Stephen Wolfram has done is to take these rules and create a language that can be used to combine these rules in ways that simulate the ways that nature would combine these basic physics rules. The main problem is that nature often combines these rules in a sequence, thus the rules simulating nature must also be performed in that sequence. Each of the rules or programs may be simple, but the way they are sequenced will create a complex result. The term for this comparison between the “real” world and the computation is Principals of Computational Equivalence. In the past, scientists have tried to simplify the overall process, which might work for a specific process, but not for the generalized process. Building up from the simple, where some rules can be stated in a single sentence, will shake up the traditional “scientific method” in many, if not all, fields. Stephen Wolfram is introducing a paradigm shift for the way we think things work in all fields from the sciences through social studies and philosophy.

The way Wolfram Research describes their language is: “The Wolfram Language is both old and new: with a long history, but full of new ideas. It has many attributes that map well onto common modern programming language buzzwords—as well as many attributes that are not familiar from other languages.” The Wolfram Language incorporates a growing amount of knowledge into the language. To better understand the language, I recommend reading the Principals and Concepts page.

Since this is a new way about thinking about how to model the real world, I have to relate it to something I do know, which is Object Oriented Programming. In OOP, everything is derived from Object definitions. For example, components of an engine can be defined as objects. As variations are needed, a new object can inherit all of the information about an existing object and then add or modify any features that might be needed. Once the objects are defined, then they can be used to build a larger object. For examples an engine block, pistons, rings, etc. make up an engine. Defining any one of these objects can be simple, but how they work together becomes complex. This is true about the Wolfram Alpha Language also.

Growing a Triangle

The example that is given in the book is for determining the color of a graph square based on the colors of the three cells above it, the one directly above and the one to its left and the one to its right. The two colors that are used are either black or white. The first example just had the new square colored black if any of the three cells above were black:

SquareFill1

If we assign each new square a binary value, 1 for black and 0 for white, then this pattern would be 11111110 or 254. The book describes creating a pattern for each of the 256 patters (0 through 256). The 0 pattern would produce all white squares from after the first row. Likewise the 256 patter would produce all black cells from the second row down. The shown 254 pattern  will produce a solid black triangle, starting with the black square at the top. As long as the fourth and seventh patterns produce a black square (and the eighth pattern produces a white square), the outside of the figure will be a ever expanding triangle. It is the other five patterns that produce some quite complex and interesting patterns. The basic patterns remain quite simple, but the output does not. Stephen Wolfram then talks about simplifying this into tag systems with even simpler transition rules. However, with the tag system he also introduces more types of cells than just black and white. The point here is that there are some types of coding that use a similar set of substitution rules, that may seem simple in structure, but can become quite complex in implementation. This is one of the reasons for the development of Mathematica to better understand and describe these simple rules -> complex behavior. To better understand the generated complex data, it is often best to represent the results with pictures.

“Everything in the Wolfram Language is a symbolic expression”

Any entry in the Wolfram language is a symbolic expression, whether it be a line of code or diagram, or interactive object. There are basic building blocks to the language that can be manipulated in similar fashions. The Wolfram Language interpreter takes care of as much of the complexity as you would like. It does allow you to take over as much of this complexity as you would like, but that is a choice you can make depending on how much you want to control how the environment handles the problem you present. The input lines start with “in” and the results (output) have an initial “out” to differentiate where the input stops and the output begins. The first example is the Wolfram Cloud example from the website. Click the Wolfram Cloud header below to go and look at the example. Stephen Wolfram strived to make the design as coherent as possible, building in as much usable knowledge as the real world has to offer.  The language is designed to learn and grow, it is designed to take advantage of other knowledge basses on the web and calls to and from other development languages.  It simplicity and coherence of design make it a very usable language.

Basics

The Wolfram Language developed over time as the language needed to create Mathematica and then Wolfram|Alpha. It is developed in a way that combines some of the basic principals of a programming language with the goal of accessing large knowledge bases. It’s syntax is well defined and simple. Some of the basic components are:

  • Notebook – The development environment in which all queries/programs are developed. The free and paid versions allow the use of notebooks on a wolfram cluster server. Even with the free version, I have found I can have multiple notebooks, so I need to track which notebook contains which project. Be sure to login each time to be able to access your notebook(s). The environment does allow a visitor to open a new workbook just in going to the start page, but logging in allows a user to work on the already used notebooks. The Notebook is the basic development tool in both the Wolfram Language Environment and the Wolfram Mathematica environment. Mathematica will be discussed later. Work areas in Mathematica seem to be easier to name, but the Notebook in each environment is very similar.
  • Login – On the far right corner, just to the right of the search box.
  • Help/Search – On the upper right corner of the Notebook is a search box. I find this quite helpful in looking up commands to see a brief definition and multiple examples of how they are used.
  • All Files box – This is where all your files are listed, both your notebooks and generated files. This is very nicely done and easy to navigate. The only update I would like to see is to be able to move the boundary between the notebook/coding section and the All Files section, depending on what is needed to be viewed at the time. Files can be deleted, if you no longer need them.
  • Symbolic Expressions – “Everything in the Wolfram Language is a symbolic expression.”  This is a very nice feature, where the same command can be used on any time of object. For me, the closest analogy I can give is overloading of a function in Object Oriented Programming. For example, the Plus[] function should handle any items in a reasonable fashion.
  • Functions – Built in actions that will be taken when requested/called. Functions always start with a capital letter, with a capital letter for each new word and no spaces between the words (for example DisplayForm). If the Function requires parameters, the parameters must be within square brackets immediately following the function call. If the function does not need parameters, like Now, no brackets are require.
  • f[x_] – is a special case function that will be defined by a formula that uses the parameter(s) passed into it. It is the only function that requires a lower case first letter. An example of a function is:
    f[x_]:= 3*x^2+9*x-12
    

    A full example of this will be later in this paper.

  • Assignments – Assignments can either be done at the time the assignment is defined (=) or delayed until the assignment is actually needed (:=). The f[x_] function described previously must not be evaluated until it is needed. Therefore the previous example uses the “:=” assignment. Items where their evaluation will change over time, must use the “:=” assignment. For those who have programmed in either LISP or PROLOG will be quite familiar with delayed evaluations.
  • Variables – Always begin with a lower case letter. For Wolfram Language Commands, variables are contained in square brackets ([]). For example:
    Plot [x^2 -3x+4]
    

    If variables are in a f[x_] function, they must always end with an underscore “_” to indicate that the variable will be defined later. This goes hand-in-hand with the “:=” postponed assignment value. If it is assigned a value like “a=x” then no underscore is needed.

  • Lists of {} – Lists can be written in one of two ways {a,b,c} or List[a,b,c]. Either way should produce the same results. The first way is often used for coordinates, for example:
    Graphics3D[Sphere[{3,4,5},2]]
    

    will produce a graph that is centered at the coordinates {3,4,5} with a radius of 2.

  • Shift+Enter – Enter by itself just means go to a new line. This is used for documentation (and similar purposes). Shift+Enter on a Notebook Input line will cause evaluation of the Input.
  • Types of Input – There is a line across the page separating each section in the Notebook’s work area. On the left end of this line is a + sign. Left click on it and a list of input types is displayed. The main ones are:
    • Wolfram Language Input (default) – strict input based on the constructs of the Wolfram Language
    • Free-Form Input – a good interpreter of general language questions. This mode is close to the one used by Wolfram|Alpha. It’s prompt includes a small red equal sign in it. This allows more natural language input.
    • Wolfram|Alpha Query – Also lets quesries come in many forms. The prompt is a small red sunburst with a yellow equal sign in the middle. This also accepts multiple types of income, based on the interpreter for Wolfram|Alpha.
    • Plain Text – Allows plain text to be entered.
    • Other style text… – Brings up a dialog box that has a list of choices for a general title for the page as well as for chapter, subchapter, section, subsection, subsubsection headers).

Wolfram Cloud

What I have showed before are the example sections. To better understand the language, you must learn to program in the Wolfram Cloud. Eventually, you will have your own Notebook where your work will be stored. This is located in the Wolfram Cloud. You are allocated space in the Cloud based on the type of user you are. All the initial examples here are using the complimentary version of the Wolfram Language, no cost to the user with a limited amount of storage in the cloud. When I become more advanced, I will purchase a regular account and go through some exercises to build applications I will find useful and deploy them to my website.

The interesting cloud example allows the user to create a Word Cloud for “frog” articles. To make it more interesting, I looked for “Alpha” articles. The first command to run loads the strings found into a text buffer with a specified length.

text=WikipediaData["Alpha"];\
StringTake[text,5000]

The results are printed below the query. The next step is to create a Word Cloud:

WordCloud[text]

which results in the following Word Cloud:

Alpha Word Cloud

Notice the dominance of the word “the” which should be removed to give a better idea of the use of the important words. The most common word is written in a bark blue. so Alpha is not even the most common word in this example:

WordCloud[DeleteStopwords[text]]

which results in a Word Cloud with only the important words:

alphaNoStopWords

Now a concern might arise if you might have separate words based on either being upper case or lower case. To change this, make all the words the same:

WordCloud[ToLowerCase[DeleteStopwords[text]]]

which results in:

AlphaNoCaps

I actually prefer all upper case, so I changed the last command to:

WordCloud[ToUpperCase[DeleteStopwords[text]]]

and received:

AlphaUppperCase

The final step is to deploy your results to the cloud:

CloudDeploy[FormFunction[{"topic"->"String"},
WordCloud[ToUpperCase[DeleteStopwords[WikipediaData[#topic]]]]&,
"PNG"],
"Permissions"->"Public"\
]

which results in:

CloudObject[https://www.open.wolframcloud.com/objects/e7a8d700-dfd7-4041-a671-c20ad66ebfa7]

This URL only brought up a page with an entry field. Other pages I have put on the cloud work correctly. It is most likely a learning error on my part. When I finish all the other learning I would like to do, I may come back and check this example again.
For the fun of it, I did a word cloud analysis of this page (before writing this section):

text=Import["https://cookhealthalliance.com/computers/software-products-and-packages/wolfram-alpha","Text"];
WordCloud[ToUpperCase[DeleteStopwords[text]]]

Please notice that I did not get the StringTake second line to work. When I try to include it, an error message came up saying that the command “is incomplete: more input was needed.” The result without that line is:

WebPageAnalysis

It is key to note that the analysis is done on the html source and not the user visible page. This means that the html commands and website name are much more visible than the actual content. I am sure there is a way to filter that out, a task to be completed eventually. I did try sending the results to the web. It appears to have done an analysis instead. The command I used was:

CloudDeploy[APIFunction[{},
WordCloud[ToUpperCase[DeleteStopwords[text]]]&],"Permissions"->"Public"]

I did try the “\” between the “Public” and the closing bracket, but the parser complained until I removed those two items. The results (out) that were displayed was:

CloudObject[https://www.wolframcloud.com/objects/0e48e818-6307-410f-9cb6-b17101789071 ]

When I visited that site, it was a good analysis of the diagram. This is another thing to research, why it put up an analysis instead of the diagram itself.

 

Wolfram Language Starting Tutorial

The Wolfram Language is the underlying code on which Wolfram|Alpha is built. It is a computer language. Therefore proper syntax is required to tell the computer what to do.

“Why cant you just say what you want using plain English? Thats what you do in Wolfram|Alpha. And it works very well for asking short questions. But if you want to do something more complex, it quickly becomes impractical to describe everything just in plain English. And thats where the Wolfram Language comes in.”

One of the first e-mails I received contained a series of examples, starting at a very simple “2+2. As the examples became more complicated, they became more interesting.

Flags of all Nations and Most Territories

The example I liked best was the one where, after running the code, it generated a Wolfram webpage that allowed me to type in a country and it would display the country’s flag. This worked for states and territories also. The code is:

CloudDeploy[FormFunction[{"country"->"Country"},Show[#country["Flag"],ImageSize->600]&,"SVG"]]

The command tells the computer to deploy to the cloud a Form, based on the input of the desired country, the flag of that country in a Wolfram size of 600. Note to self, find out what “SVG” means. The result is:

CloudObject[https://www.wolframcloud.com/objects/adaa331d-043c-4f1b-a52a-ad039b5899ad]

The generated link is stored in the notebook. To see where it is listed, I opened the All File area on the right of the Notebook and clicked the Unnamed Cloud Objects entry and saw all the cloud files I have generated. Since CloudObject commands generate a new file every time they are executed, I have realized I need to carefully Delete the unwanted files so that I can both find the CloudObject files I want and I do not waste too much space on my account. The generated entry page appears as:

Country Flag input

while the output for this entry was:

Country Flag Output

When I did try the CloudObject[] link above and typed in “Norway” the following flag was displayed:

Country Flag Norway

I wish I could just copy the code and have the page on this site. I did try the link above and it is still working. I did try it also for Scotland and England. I noticed that England brought up the Great Britain flag, while Scotland brought up “No country interpretation found. Try again.” Since most of my ancestors are from Scotland, that is an interesting difference.

FormFunction vs APIFunction

The above example used a FormFunction to create a cloud page that allows no initial input to be passed with the call. The alternate Function is the APIFunction which does require the application to be passed all neede parameters through the interface to function properly. If you CloudDeploy an APIFunction, it produces a webpage that says that a parameter is expected. When I saved a pointer to the Cloud Deployment, I could pass in a parameter on the command line to produce the desired results. Fore example, to create the pointer to the webpage, I would enter:

api=CloudDeploy[APIFunction[{"country"->"Country"},Show[#country["Flag"],ImageSize->600]&,"PNG"]]

This produced a Cloud Deployment similar to the one produced by the FormFunction.

CloudObject[https://www.wolframcloud.com/objects/d774a386-a2ba-475b-ac57-6ae34e616b96]

Since the variable api is now defined, it can be used in a call to the webpage with the needed parameter:

URLExecute[api,{"country"->"Panama"}]

which results in the appropriate flag.

Country Flag Panama

Other Examples

The best way to show the difference of immediate and delayed evaluations is to show you the results of doing the two. The letter a will be assigned immediately, while t will be a delayed evaluation. To execute this commands, be sure to press [Shift]+[Enter].

In[1] a = Now
In[2] t := Now
In[3] a
Out[3] May 20, 2016 11:14 am GMT -6
In[4] t
Out[4] May 20, 2016 11:14 am GMT -6

Wait four minutes and try it again:

In[5] a
Out[5] May 20, 2016 11:14 am GMT -6
In[6] t
Out[6] May 20, 2016 11:18 am GMT -6

Functions are also interesting, if I just write a function, it will return it’s interpretation of the function. If I used the delay assignment, it will store the function and then evaluate any input I give it. For example:

In[7] f[3*x^2+9*x-12]
Out[7] f[ -12 + 9x + 3x2]
In[8] f[x_]:= 3*x^2+9*x-12
In[9] f[5]
Out[9] 108
In[10] f[9]
Out[10] 312
In[11] Clear[f]

The last input clears the function f[] so that it can be used for other purposes. Sounds can also be included in a program. For example, play three notes on a piano:

EmbedCode[CloudDeploy[Sound[SoundNote[{"C","G","ASharp"},3,"Piano",SoundVolume->1/8]]]]

which produces code that can be embedded into an HTML file:

<iframe src="https://www.wolframcloud.com/objects/4b385514-060d-4f2d-b4a1-b5d30ff3c41f?_embed=iframe" width="600" height="80">

I then put in the following line to close off the iframe command:

</iframe>

If I actually embed the code,  the piano sound will play upon entry into this page, instead of waiting until the play button is pushed. Also, the documentation says that the volume can be manipulated, but setting it to 1/8 did not seem to lower the volume.

Graphic Functions and Manipulation

The Wolfram Language can create shapes and give them colors, the colors can also be manipulated. I typed in the following command and pressing Shift+Enter generated the subsequent diagram, with the three manipulation bars. The variable slider-bar definitions, like [r,0,1,0.05], means that the r variable can be set from 0 through 1 with increments of 0.05. The slider-bar variable definitions are a part of the Manipulate command, thus they are out of the RGBColor command brackets. This is the only way that Manipulate can actually know what the variables to be manipulated are and what their values can be.

In[19] Manipulate[Graphics3D[Style[Sphere[],RGBColor[r,g,b]]],{r,0,1,0.05},{g,0,1,0.5},{b,0,1,0.05}]
Manipulate the RGB colors of a sphere

Manipulate the RGB colors of a sphere

I deployed this figure to the Wolfram Cloud so that you can manipulate the sliders. I did try to EmbedCode[] this function, but at this point it just brought up the slider image in the Wolfram Cloud.

I have been using the Wolfram Notebook so far for my exploration. As I dig deeper, I have noticed a Wolfram Workbench 2, which seems to work with Mathematica. As I learn more, I will include it here. Workbench is a Development Environment based on the Eclipse Environment.

Mathematica

The Mathematica portion of Wolfram Environment is well developed. It is the environment in which people can program the Wolfram Language. When I first started using the Wolfram Language, I started using the Wolfram Notebook. Wolfram Mathematica has a development environment that is basically a notebook, with the capability to name modules that seems to be able to be compiled into larger projects. This section will deal with my exploration of the Wolfram Mathematic Environment. It has two development environments, one on-line and a downloadable version. I was sent a pointer to a group of videos that describe the Mathematica environment.

Some features of Mathematica include the capability of 3-D animation to better represent the generated solutions. Mathematica has many examples that can easily be performed. It has a free trial version and a purchase version. The animation tool is the Computable Document Format (CDF). Mathematica and the CDF player are heavily used in the Wolfram Language and the Wolfram|Alpha product. Since Mathematica is the original Wolfram Research product and the basis for the development of the Wolfram Language. Wolfram|Alpha, which was described previously, is an easy way to use many of the capabilities of Mathematica and the Wolfram Language.

My first Mathematica Notebook was created in following the first Mathematica video. Sections are divided by horizontal bars. In this example, there is a title and three sections. The third section has a subsection and a text cell. If you notice the brackets on the right, the overall section bracket encompasses the other items in that section. It can be double-clicked to collapse the section.

Video guided Mathematica Notebook creation.

Video guided Mathematica Notebook creation

The next video covers creating basic commands. It goes over some of the rules in great detail that are listed in my Basics subsection of the Wolfram Language section above. Using the Wolfram Language, it is best to start with the Free-form Input and then look at the Wolfram Language command that is generated. For example, I created a comparative plot “plot graph for cos x for x= -10 through 10 and (sin x)/x for x=-10 through 10

Plot Cos(x) and Sin(x)/X for the range -10<=x<=10

Plot Cos(x) and Sin(x)/X for the range -10<=x<=10

If all I want is the graph, then this is all that is needed. Please notice that there are two sliders at the bottom of the graph to adjust the beginning and ending points for the graph. If I want more information, there is a grey square at the right of the line I just entered with a + in it. I will push this symbol to expand the information presented. This will include the Wolfram Language command for what I want. This gives me a better idea of how to use the Wolfram Language.

Ex[and the information presented, include the Wolfram Language Command.

Ex[and the information presented, include the Wolfram Language Command

The generated results are much more in detail than what I am showing here. The tutorial videos then go over the MANIPULATE[] command, which was discussed earlier in the >Graphic Functions and Manipulation subsection of the Wolfram Language section.

Wolfram Programming Lab

To be explored.