ECE 280/Fall 2021/MAPLE

From PrattWiki
Jump to navigation Jump to search

This web page is meant to support HW 4 Part III for the Fall 2021 ECE 280 class.

Accessing Maple

See the Using Maple: Duke Container section of the Maple page for how to reserve a Maple container and then use it. Containers are accessed via web browsers so you will not need any additional software to use Maple in this way.

Maple Basics

Go through the Other Pundit Pages on the Maple page, specifically:

Then go through the Connected Curriculum Project - Engineering Maple Tutor modules. Note that modules 12 and 14 may not come up much in this course but are interesting nonetheless!

Convolution and Correlation Examples

In the Resources section on Sakai, and specifically in the Demo Codes - F21 folder there is a folder of Convolution examples and a folder of Correlation examples. The main things to know are:

  • restart
This should always be the first executable in your worksheet; you can put your name and other text above it but you should always restart at the top in case you need to...restart your worksheet from scratch.
  • NumericEventHandler(invalid_operation=`Heaviside/EventHandler`(value_at_zero=1)):
This simply tells Maple to define the unit step function at 0 to be equal to 1 rather than leaving it undefined. It makes some functional representations much cleaner later. If this is left out, generally things will still work but there might be some undefined values in your function.
  • u:=t->Heaviside(t)
  • r:=t->t*u(t)
  • q:=t->t^2/2*u(t)
  • c:=t->t^3/6*u(t)
These just define the unit step and its first three integrals in case we want to use them later. Note that when you type the code into Maple it will put you into superscript mode when you type the ^ symbol; to get out of it, press the right arrow. Also, when you type the / key, Maple will put you in the denominator of a fraction; to get out of it, press the right arrow.
  • y:=t->int(x(t-tau)*h(tau), tau=-infinity..infinity)
Assuming x(t) and h(t) are defined, this will calculate the convolution of $$x$$ and $$h$$ for a given $$t$$. If you want to see the analytical formula for the convolution, you can type y(t)
  • convert(y(t), piecewise
This will present the function as a table of the piecewise functions and the relational operators that are true when those pieces are valid.
  • combine() ans/or simplify()
This tries to simplify whatever is inside the argument. It is not always successful...
  • subs(a=1, b=2, c=3, THING)
Substitutes in values without permanently assigning anything. Note that the substitutions need to be equations without any kind of brackets. Further note that the substitutions are only made to the last item, not all the subsequent items, so if you try subs(a=1, b=a, c=b, a+b+c) you would end up getting "1 + a + b" in return, whereas subs(c=b, b=a, a=1, a+b+c) gives you 3.
  • maximize(f(x))
Finds the maximum value of the function of $$x$$.
  • evalf(THING)
Evaluates THING as a floating point number; this is useful in cases where Pi is involved as well as cases where Maple reports back a rational fraction.

Turning In Work

For this assignment you will be turning in a PDF of your work to Gradescope and you will be uploading your mw worksheet to Sakai. To make a PDF, go to File -> Export As and then in the "Files of Type" change the option to PDF. To upload to Sakai, go to Sakai go to the class, and then click "Drop Box" at left. Once there, click the "Action" drop down and make a new folder called "HW 4" - once that exists, click "HW 4"'s action button and upload the .mw file there. Note that since the files live in the container, you will want to do all this using the Firefox browser that is included in the container. Alternately, you can use the Firefox browser to go to box.duke.edu, upload things from the container to your box drive, download things from your box drive to your own computer, and upload things from there. That doesn't sound tedious at all!!!