Download MuPAD from SciFace

MuPAD Pro Computing Essentials - Examples 

Example 7.8 - Plotting Mandelbrot Hill

If you are familiar with Mandelbrot fractal then here is 3D plot of a function that is used to develop Mandelbrot fractal. The idea is simple - instead of plotting various colors use values of the function as a function from R^2 -> R.

export(plot,Function3d):
Iterations := 100:

mandel:=proc(x,y)

local m,a,b,t;
begin
   if not (testtype(x,Type::Real)and
           testtype(y,Type::Real))
   then
      procname(x,y)
   else
      m := 0;
      a := x;
      b := y;
      while sqrt(x^2+y^2)<2 and m <Iterations do
         t := x;
         x := a + x^2 - y^2;
         y := b + 2*t*y;
         m := m+1
      end;
      return(float(1/Iterations*m))
   end
end:
 

g:=(x,y,z)->[abs(sin(x)), abs(sin(y)), abs(sin(z))]:
  
MandHill := Function3d(
   mandel(x,y), x=-1.8..1.2, y=-1.5..1.5,
   Color = [Function, g],
   Grid = [40,40]
):
  
plot(
   MandHill,
   Scaling = UnConstrained,
   BackGround = [0.8,0.8,1],
   CameraPoint = [-30,-50,40],
   FocalPoint = [0,0,0],
   Axes = None
)

 

TOP