Question: Help me understand this Gibberish!

Hello, so i have been given the daunting task of figuring out what some maple stuff means in a worksheet. Now this is complete gibberish to me so i was hoping someone can kind of dumb it down for me and explain what is going on in the BOLD TYPE portion of the worksheet below. At the bottom i have also attached my maple file so you can look at it in actually maple. What the professor has asked from me is;

II) Write a short user's manual for this worksheet that describes with stunning clarity what the role of each and every variable and calculation in the if/then loop is. You will surely need to copy the worksheet commands into this user's manual but I don't want a print out of your Maple worksheet. I want a word processed document that would get high marks in your writing class.

 I am asking someone to give me a manual of it so i can write a manual. Thanks

restart;
with(plots);
with(plottools);

[animate, animate3d, animatecurve, arrow, changecoords, complexplot,

  complexplot3d, conformal, conformal3d, contourplot, contourplot3d,

  coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot,

  fieldplot3d, gradplot, gradplot3d, graphplot3d, implicitplot,

  implicitplot3d, inequal, interactive, interactiveparams, intersectplot,

  listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d,

  loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare,

  pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d,

  polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors,

  setoptions, setoptions3d, spacecurve, sparsematrixplot, surfdata, textplot,

  textplot3d, tubeplot]
[arc, arrow, circle, cone, cuboid, curve, cutin, cutout, cylinder, disk,

  dodecahedron, ellipse, ellipticArc, hemisphere, hexahedron, homothety,

  hyperbola, icosahedron, line, octahedron, parallelepiped, pieslice, point,

  polygon, project, rectangle, reflect, rotate, scale, semitorus, sphere,

  stellate, tetrahedron, torus, transform, translate]
Now that we have the tools into the system now wwe have to define the shape of the reflective surface which for our purposes might be circular or parabolic in cross section
        Circular  would be of the form f(x) = A-sqrt(B-x^2)
        mirror(x) is a function which defines the shape of reflective surface
        slope(x) is the derivative of mirror(x).
This worksheet assumes that you can define such continuous and differentiable functions for the reflective surface you want to explore.
f(x)=ax^2+b
mirror := x -> (.025*x^2 +2);     # Mirror
slope := x -> (.05*x);  # slope at each point on mirror
width := 20.0;                   # x = -slope..slope
height := 2 * width;             # y = 0..height
n := 10;                         # number of light rays

            2   
x -> 0.025 x  + 2
x -> 0.05 x
                                    20.0
                                    40.0
                                     10
mirrorplot := plot(mirror(x),
            x = -width..width, y = 0..height,
            axes = NONE, scaling = CONSTRAINED, color = black):
display(mirrorplot):


 
Now that we have defined and plotted the reflective surface it's time to figure out what happens to the light after it hits the surface. I have defined the array of incoming rays separately from the reflected rays so that I can plot them in different colors - helps me keep track of what's happening.

raysin := {}; #this defines raysin/out as sets of objects - plots                # in this case - that will be used later.
raysout:= {};

for i from 0 to n do
    x := -width + 2 * i * width/n: #distribute rays evenly
    y := mirror(x):                #mirror location
    raysin := raysin union {line([x, height], [x, y])}:
        # line([],[]) is a plot tool that produces a plotted line          # between the two points given. union is a set command             # that combines the existing raysin set with the new               # object in the {} brackets
    dr := slope(x): # dr is the derivative
    if (abs(dr) > 0.001) then   # if slope = 0 no outgoing ray
       m := (dr^2 - 1)/(2 * dr);
       ix := (height - y)/m:
       if ix < -width then
          tx := -width:
          ty := y + m * (tx - x):
         elif
          ix > width then
          tx := width:
          ty := y + m * (tx - x):
         else
          ty := height:
          tx := (ty - y)/m + x:
        end if: # end if
    raysout := raysout union {line([x,y], [tx, ty])}:
    else
        tx:=x:
        ty:=height:
        raysout := raysout union {line([x,y], [tx, ty])}:
    end if: # end if
end do: # end do

rdrawin  := display(raysin, color = green, axes = NONE, scaling = CONSTRAINED):
rdrawout  := display(raysout, color = red, axes = NONE, scaling = CONSTRAINED):

unassign('x'):
unassign('y'):

display({mirrorplot,rdrawin,rdrawout});
                                     {}
                                     {}

 

 


View 11552_Maple Worksheet.mw on MapleNet or Download 11552_Maple Worksheet.mw
View file details




 

Please Wait...