Tuesday, 25 February 2014

Mathematica: Introducing the Wolfram Language

Finally, here it is, check out the video below as Stephen Wolfram showcases the Wolfram language,



From my previous post, I said that I used Wolfram Mathematica for about a year before I embrace R. And frankly, I've been in love with Mathematica; it never stops on suprising me every time I use it. You can have beautiful, interactive 3D plots or any type of plots in just few lines of code; you can estimate symbolically the maximum likelihood of a distribution; and many fun stuffs. In fact, I have screencasts on Youtube about Mathematica, here it is

LaTeX: How to install TeX Live - qtree package in Ubuntu 12.10

There is a question on TeX - StackExchange that has no direct solution to the installation of the qtree - TeX Live package in Ubuntu. And I want to answer that in this post, then just drop the link of this article to the comment section of the said query. So here is what I did:
  1. Open the Ubuntu Dash, and search for Ubuntu Software Center;
  2. In the Software Center, search for qtree;
  3. Select the first entry (Humanities Packages), and click on More Info to confirm if qtree is indeed included in this item;
  4. Finally, click .
There you go, you can try it now. Here is a simple Statistics problem from Elementary Statistics Book of MSU-IIT Department of Mathematics and Statistics that uses tree diagram,

Wednesday, 19 February 2014

R: Fun with surf3D function

There is one package that I've been longing. A package that will give me the power to manipulate and do any 3D stuffs in R. I tried persp and wireframe, but I find them difficult to use especially on complicated mathematical functions, like doing parametric plots. And I am just frustrated about that, since I envy the 3D graphics of Wolfram Mathematica a lot, which I exploited for about a year, before I embrace R. However, that has come to an end after Joseph Rickert introduced the plot3D (authored by Karline Soetaert) package in his post. And for the moment, we will be playing with the surf3D function. Here is the first one, the Mollusc Shell surface plot:
With parametric equations:
$$
 \begin{eqnarray}
x(u,v)&=&\left(1.16^v\right)(1 + \cos(u))\cos(v);\nonumber\\
y(u,v)&=&\left(-1.16^v\right)(1 + \cos(u))\sin(v);\nonumber\\
z(u,v)&=&\left(-2\times 1.16^v\right)(1 + \sin(u));\nonumber
\end{eqnarray}
$$where $u\in[0, 2\pi],\,v\in[-15, 6]$. By the way, I am not sure if that's the general equations of the Mollusc shell, I can't find one on the web. In case you know it, please inform me by commenting below. The above equations was based from the Mathematica Documentation, with code

Now with extra animation, here is the R equivalent:


Thursday, 13 February 2014

R: Animating 2D and 3D plots

One great package in R is the animation made by Yihui Xie. And just for fun, we are going to explore that. Our aim is to create simple animated 2D and 3D plots. Here is the first one, 2D of course
The code,

It's a piece of cake right? The function we used for wrapping the plot is saveGIF, this function basically collects all the plots made and use these as frames of the GIF file. In other words, the above plot was generated/looped 100 times through the curve function, and in every iteration we increased the limits of the x axis; hence rolling all the generated plots, animates x-axis towards positive values.

What about 3-dimensional? Speechless,