Download MuPAD from SciFace

MuPAD Pro Computing Essentials - Examples 

Example 8.10a - Demonstration of turtle graphics

Note, in my book this example does not have a number.  In order to make things more organized I use for it here number 10a, that suggest that this example shall be placed before the example 11. 

export(plot,Turtle):
T := Turtle():

Oct := proc()
   local i;
begin
   T::color(RGB::Red),
   for i from 1 to 8 do
      T::right(45),
      T::line(1)
   end
end:
 
dist:=2.1:
T::push():
 
for i from 1 to 5 do
   T::pop(),
   T::push(),
   T::move(i*dist),
   for j from 1 to 8 do
      Oct(),
      T::right(90),
      T::move(dist),
      T::left(90)
   end
end:
  
plot(T,
   Scaling=Constrained,
   LineWidth=15,
   Axes=None,
   BackGround=RGB::Gold
):

    

 

TOP