Thursday, September 22, 2011

wxMaxima - 2D plots with one or more functions

Alright so let's keep this ball rolling.  Next, I would like to enter an equation as a function and then plot that function on a 2D graph in Maxima.  I would also like to gauge this function versus a couple of more so I will have three functions plotted on the same graph.

As a continuation from the previous post, I am entering in and defining a function for tangential velocities.  It is as easy as before.  I set

u_theta2(u):= %pi*(lamb_da(al_pha) + csc(u)*cot(u) - (csc(u))^2 - log(tan(u/2)));

or

$u_{\theta} = \pi \left( \lambda + \csc \phi \cot \phi - \csc^2 \phi - \ln \Phi \right)$

where $$\Phi = \tan \dfrac{\phi}{2}$$.

Right now I am using the variable "u" in place of $$\phi$$.  I will try to change that to "phee" later.I will aslo try to make a function for "big_phee" for $$\Phi$$ too.

I also create the function one_over_R_sin(u) for comparison and choose a constant $$R$$ while varying $$\phi$$.

one_over_R_sin(u):= 1/(0.7*sin(u));

$u_{\theta} = \dfrac{1}{R \sin \phi}$

Then we can plot by

plot2d([u_theta2(u), one_over_R_sin(u)], [u, 0.00001, %pi/6], [y, 0, 20]);

So the plot2d a 2-d graph or plot.  The first argument allow you to plot more than one function as the notation of [f(x), g(x)],.  If we were to just plot one function there would be no need for the square brace [ ] but instead just the function f(x),.  The next argument allows the range for the "x" variable which in this case is u.  So I let u range from 0 to my angle $$\alpha$$ of $$30^{\circ}$$ or $$\dfrac{\pi}{6}$$ radians.  This must be encased in a square brace [ ].  Then, if we like, we can give a range for the "y-axis" which I ranged from 0 to 20.