Skip to main content
Contents Index
Dark Mode Prev Up Next
\(\usepackage{siunitx}
\newcommand{\lrp}[1]{\left(#1\right)}
\newcommand{\lrb}[1]{\left[#1\right]}
\newcommand{\lrbrace}[1]{\left\lbrace#1\right\rbrace}
\newcommand{\abs}[1]{\left|#1\right|}
\newcommand{\dint}{\displaystyle\int}
\newcommand{\defint}[2]{\dint^{#2}_{#1}}
\newcommand{\dlim}[2]{\displaystyle\lim_{#1\rightarrow #2}\,}
\newcommand{\dydx}{\dfrac{dy}{dx}}
\newcommand{\ddx}{\tfrac{d}{dx}}
\newcommand{\dddx}{\dfrac{d}{dx}}
\newcommand{\ifsol}[1]{\ifprintanswers{#1}\fi}
\newcommand{\Nat}{\mathbb{N}}
\newcommand{\Whole}{\mathbb{W}}
\newcommand{\Int}{\mathbb{Z}}
\newcommand{\Rat}{\mathbb{Q}}
\newcommand{\Real}{\mathbb{R}}
\newcommand{\Complex}{\mathbb{C}}
\DeclareMathOperator\arcsinh{arcsinh}
\DeclareMathOperator\arccosh{arccosh}
\DeclareMathOperator\arctanh{arctanh}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\newcommand{\sfrac}[2]{{#1}/{#2}}
\)
Section 1.3 The Assignment Operator and Creating Functions
Subsection 1.3.1 Recommended Tutorials
Before starting on these exercises, you should familiarize yourself with the material covered in the following tutorials:
Subsection 1.3.2 Introduction
In this activity, you will be using the assignment operator
:=, which allows you assign Maple output to a name of your choice. This is especially useful for assigning expressions and functions on one Maple input, before manipulating those expressions later on in your worksheet.
Exercises 1.3.3 Exercises
1.
In this exercise, youβll learn how to evaluate an expression at a given value of
\(x\) two ways: using the
subs() command, and using function notation.
Aside Instead of using the
subs command multiple times, it is often a better practice to define a function and use function notation instead.
(a)
Assign the expression
\(\dfrac{\sin(x)+3}{\cos(x)+1}\) to
expr as follows:
> expr := ( sin(x) + 3)/( cos(x) + 1);
Then use the
subs() command to substitute
\(x=3\) into
expr. Evaluate the result as a decimal with
\(15\) digits.
(b)
Assign the function
\(g(x) = \dfrac{\sin(x)+3}{\cos(x)+1}\) as follows:
> g(x) := ( sin(x) + 3)/( cos(x) + 1);
Now, evaluate
\(g(3)\) to
\(15\) digits to get the same result.
2.
Assign the expression
\(x^2+2^x\) to
expr2. Then, substitute
\(y =\) Β
expr2 into
\(y^2+3y\) and expand the result.
3.
Assign the expression
\(2x^2-4x+7\) to
poly and then substitute
\(x=5+h\) into
poly and simplify.
4.
The function
\(f(x) = (1-x^2) { e}^{-\sfrac{x^2}{2}}\) is known as the Mexican Hat Function.
(a)
Assign the function to
\(f(x)\) using the
:= operator.
Hint .
The exponential function,
\({ e}^x\text{,}\) in Maple may be typed as
exp(x). You may also use the palette toolbar to use the proper
\(e\text{.}\) You may not simply type the letter `e` for the natural exponential function.
(b)
Plot the graph of
\(f(x)\text{.}\) Adjust the bounds and scaling of the graph as necessary to see why this is known as the Mexican Hat Function.
5.
Maple, by default, does not know the function
\begin{equation*}
sinc(x) = \dfrac{\sin(\pi x)}{\pi x}\text{,}
\end{equation*}
which is important in engineering.
Aside Often, this function is denoted as
\({ sinc}_\pi(x)\) and
\({ sinc}(x) = \frac{\sin (x)}{x}\text{.}\)
(a)
Assign the
\(sinc(x)\) function using the assignment operator.
Hint 1 .
Be sure to include a multiplication symbol or space between
\(\pi\) and
\(x\text{.}\)
Hint 2 .
The mathematical constant
\(\pi = 3.14...\) must be typed into Maple as
Pi.
(b)
Evaluate
\(sinc(3)\text{,}\) \(sinc\left(\frac{1}{2}\right)\text{,}\) and
\(sinc(0.25)\text{.}\)
(c)
Plot the graph of
\(sinc(x)\text{.}\)