Hi Everyone. This is going to be a short post showing the basics of Wolfram language programming. I am writing this post live online using the Wolfram programming lab. With an email address you can get a Wolfram account which enables you have access to Wolfram cloud notebooks for free.
You can open this notebook on the Cloud and play around with the code.
You can open this notebook on the Cloud and play around with the code.
Wolfram language is a symbolic/functional programming language. It is symbolic in this sense
In[]:=
a
Out[]=
a
In other programming languages, just typing in a symbol like that without initializing it will result in either an error or something like None. But in Wolfram language it is just what it is. Let us build an expression using symbols like that above.
In[]:=
a+b
Out[]=
a+b
This is just a symbolic expression that adds two symbols a, and b. Lets build it further.
In[]:=
Expand[(a+b)^2]
Out[]=
2
a
2
b
In the previous line we see the result of Expanding a symbolic expression using a function (Expand[ ]) . The result is still a symbolic expression which we can use to perform other transformations.
In[]:=
Expand[(a+b)^3]
Out[]=
3
a
2
a
2
b
3
b
In[]:=
Plot3D[Expand[(a+b)^3],{a,-1.85883,1.85883},{b,-1.85883,1.85883}]
Out[]=
It is straightforward to generate a plot from our previous expression.
This is a simple demonstration of programming in the Wolfram language which is the language in which Mathematica was built with. Of course this is not even the tip of the iceberg but probably 1/10th of 1/10th of that tip. In the series of posts that will follow I will keep on bringing out more and more aspects of the language and you will see how fun indeed it is to program in the Wolfram language. For those who want to go beyond this, Stephen Wolfram's book: An Elementary Introduction to the Wolfram language is available at this URL https://www.wolfram.com/language/elementary-introduction/2nd-ed/