e-Statistics > 4470-5470 Probability and Statistics I

Example in Note 3

Maxima has a powerful graphics function draw3d. In order to use it we must first load the "draw" package.
--> load(draw)
In a 3D plot a function is described in the format

$\displaystyle \texttt{explicit}(f(x,y),x,x_{min},x_{max},y,y_{min},y_{max})

with the plotting range $ [x_{min},x_{max}]$ and $ [y_{min},y_{max}]$.

Here we introduce the density function

$\displaystyle f(x,y) = \begin{cases}
\lambda^2 e^{-\lambda y} \quad & \mbox{ if $0 \le x \le y$; } \\
0 & \mbox{ otherwise. }

In Maxima it can be defined with the symbol ":="
--> f(x,y) := if x < y then lmd^2 * exp(-lmd * y) else 0;
Also, we have to set the parameter $ \lambda$ with the symbol ":" as follows:
--> lmd: 2
Now we can draw a surface when "enhanced3d=true" is specified.
--> draw3d(enhanced3d=true,
       user_preamble="unset colorbox")

The following wxm file contains the above code:


© TTU Mathematics