## 1 tháng 4, 2012

### A some examples in MUPAD

MuPAD was a Computer algebra system (CAS). Originally developed by the MuPAD research group at the University of Paderborn, Germany, it was developed by the company SciFace Software GmbH & Co. KG in cooperation with the MuPAD research group and partners from some other universities since 1997.
I found MuPAD a very cool tool for plotting graph of functions. I will show you in details some examples.

1. We start with the following function
$f(x,y)=-(x^2+y^2)(\cos (3y) + \sin (7y))$.
To plot its graph, I use the following
f := plot::Function3d(exp(-x^2-y^2)*(cos(3*y)+sin(7*x)), x=-2..2, y=-2..2, Submesh=[1,1], FillColorFunction=((x, y, z) -> [(z+2)/4, 0.5, (2-z)/4])): plot(f)
and this is what we get
To obtain the following picture
you need
f := plot::Function3d(exp(-x^2-y^2)*(cos(3*y)+sin(7*x)),x=-2..2, y=-2..2,Submesh=[1,1]):graphLines:=plot::modify(f, Filled = FALSE, XLinesVisible = FALSE, YLinesVisible = FALSE,ZContours = [Automatic, 15], LineColorFunction=((x, y, z) -> [(z+2)/4, 0.5, (2-z)/4])):linesProjection := plot::Transform3d([0, 0, -1.5], // shift vector[1, 0, 0, // transformation matrix0, 1, 0,0, 0, 0],graphLines):plot(f,linesProjection)
2. With the following function
${\rm Re}(\cos (x+iy)$.
To plot its graph, I use the following
f := plot::Function3d(Re(cos(x+I*y)), x=-2..2, y=-2..2, Submesh=[1,1], FillColorFunction=((x, y, z) -> [(z+2)/4, 0.5, (2-z)/4])): plot(f)
and this is what we get3. If our function has singularities, for example, Gamma function $f(x,y)=|\Gamma (x+iy)|$, we have
f := plot::Function3d(abs(gamma(x+I*y)), x=-4.5..4.5, y=-3..3, Submesh=[3,3], XSubmesh = 1, YSubmesh = 2): plot(f)
4. If you intend to plot sereval graphs, the following is a good example.
Here we used functions $\sin(x^2 + y^2)$$\cos(x^2 - y^2)$. The code I used is
plotfunc3d(sin(x^2 + y^2), cos(x^2 - y^2), x = 0..1, y = 0..2)
5. The Mobius band can be drawn by using the following
x := cos(alpha) * (1 + r * cos(alpha/2)):y := sin(alpha) * (1 + r * cos(alpha/2)):z := r * sin(alpha/2):plot(plot::Surface([x,y,z], r = -0.5 .. 0.5, alpha = -PI .. PI,Mesh = [35, 31], LineColor = RGB::Black.[0.2]),Axes = None, Scaling = Constrained)
6. If you need a transparent picture, probably you need to add a factor like abs(sin(z)) in the FillColorFunction. Following is an example
K := (x,y,z)->[abs(sin(x)), abs(sin(y)), abs(sin(z)), abs(sin(z))]:F1 := plot::Function3d(1.7*x*exp(-1/2*(x^2+y^2)),x=-4..4, y=-4..4,FillColorFunction=K):F2 := plot::Function3d(-1, x=-4..4, y=-4..4):plot(F1, F2)
The original one is
7. I will end this topic by showing some more pictures obtained by zooming a little bit closed.
plotfunc3d(sin(x - -PI)*sin(y - -PI), Submesh = [4, 4], x = -PI .. PI, y = -PI .. PI)
In conclusion, if you want to plot a general surface in 3D, you need its parametrization in order to draw. For details, I prefer the reader to this paper.