Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

HONPR1B/201/0/2013

Tutorial Letter 201/0/2013

Project I
HONPR1B

Year module

Department of Decision Sciences

SOLUTIONS TO ASSIGNMENT 1

Bar code

university
Learn without limits. of south africa
HONPR1B/201/0

1 Remarks

Assignment 01 has been marked and it seems that using LATEX is quite a challenge for many students. There
are, however, many students who read the instructions carefully and submitted very good assignments and
were rewarded accordingly. Figure 1 shows a bar chart of the marks obtained by students who submitted
their assignments.

Figure 1: Marks for Assignment 1

While marking the assignment I found the following problematic aspects that must be addressed in future
assignments.
⊲ Naming of documents
It is compulsory to use your student number and surname combined with the assignment num-
ber as the name of all files that are submitted. This means that your TEX, PDF and ZIP files
should be named as prescribed, namely Student number Last name Assignment.tex. For example,
12345678 Aabcdef Ass1.tex and 12345678 Aabcdef Ass1.zip.
⊲ Title page
The title page for your assignment should be a page containing only the required information, namely
the name of the module, the assignment number, the student’s name and student number and the date.
A typical title page (created with the \maketitle command) will be an empty page with the following
on it:
HONPR1B (Project 1)
Assignment 1
John Doe
12345678
Date
⊲ Page layout and font size
Your PDF output should be in A4 format. Only specifying it in the options of the documentclass
command doesn’t have the desired effect and many students’ PDFs were in thr default Letter format.
With the geometry package the dimensions of documents can be set easily. Documentation is available
under Additional resources om myUnisa. For this module insert the following in the preamble:
\usepackage[a4paper,margin=2cm]{geometry}
A font size smaller than 11pt is hard to read. We therefore require all future assignments to be in a
font of at least 11pt.

2
HONPR1B/201/0

2 Solutions to Assignment 01

Question 1 [20]

(a) Multiple spaces between words are treated as one space in LATEX.
(b) A new paragraph is started by simply leaving a line open – without inserting any linebreaks (\\).
(c) The verbatim environment:
⊲ The in-line verbatim environment is specified by the command \verb followed by and any delimiters
other than {...}. To print the word abrakadabra verbatim, any of the following can be used:
\verb|abrakadabra| or \verb+abrakadabra+ or \verb$abrakadabra$, etc.
⊲ Enclose a paragraph to be printed verbatim between \begin{verbatim} and \end{verbatim}.
⊲ To obtain a paragraph verbatim with the spaces shown in the output, enclose the paragraph between
\begin{verbatim*} and \end{verbatim*}.
For example, the output for the code
\begin{verbatim*}AAA BBBB CCCCC DDDDD\end{verbatim*}
is
AAA BBBB CCCCC DDDDD
(d) Typing quotation marks, diacritical and other special letters:
⊲ John said “We need to find the ‘black box’ . . . !”
This sentence is typed as follows:
John said ‘‘We need to find the ‘black box’ \ldots!’’
⊲ brûe is typed as br\^ue or br\^{u}e.
⊲ Schloß is typed as Schlo\ss.
⊲ blåmärke is typed as bl\aa m\"arke.
(e) The source code for the specified document is as follows:
\documentclass[10pt,a4paper,]{article}
\usepackage{parskip}
\usepackage[a4paper]{geometry}
\title{HONPR1B (Project 1)\\ Assignment 01}
\author{John Doe\\ 12345678}
\begin{document}
\maketitle
\thispagestyle{empty}
\end{document}

3
HONPR1B/201/0

Question 2 [20]

The following source code was used to type the question:

\begin{enumerate}
\item A function $f$ is a \emph{polynomial function of degree $n\in\mathbb N$}
if there are constants $a_0;\; a_1;\; a_2;\; \ldots;\; a_n$ with $a_n\neq 0$
such that \[f(x)=a_0 + a_1 x + a_2x^2 + \cdots + a_nx^n\] for all $x$.

\bigskip
\item A useful function for financial calculations is given by the equation
\[v(1+i)^n + p(1+it)\frac{((1+i)^n-1)}{i} + f = 0,\] where
\begin{compactitem}[-]
\item $v$ is the present value;% $v$
\item $p$ is the fixed payment;% $p$ is paid
\item $n$ is the number of regular periods;
\item $i$ is the interest rate (per period);
\item $f$ is the future value; and
\item $t$ is the time of payment.
\end{compactitem}
Positive values for $v$, $f$ and $p$ represent inflow of money (that is money
you receive), while negative numbers represent outflow of money (that is money
you pay out).

\textbf{Example}\\
Find the monthly payment on a 4 year car loan of R15\,000
at a 10\% annual interest rate, compounded monthly.

\textbf{Solution}\\
The monthly interest rate $i=\frac{0,10}{12}$ (do not round it); the number of
payments $n=4\times 12=48$ and the present value $v=15\,000$.
Set $t=0$ (payments at the end of the periods) and $f=0$ (no future value)
and enter the values into the formula to get
\[15\,000\left(1+\frac{0,10}{12}\right)^{48}+p\frac{\left(1+
\frac{0,10}{12}\right)^{48}-1}{\frac{0,10}{12}}=0.\]
Solving this equation results in \[p=-380,44.\]
The monthly payment is therefore R350,44.

\bigskip
\item The constant $e$ is defined to be
\[e=\lim_{n\rightarrow \infty}\left(1+\frac{1}{n}\right)^n\] or
\[e=\sum_{n=0}^\infty\frac{1}{n!}.\]

\bigskip
\item The {\em natural logarithm} function $\ln x$ is defined by
\[\ln x = \log_e x\] where $e$ is a special constant, with
\[e=2,718281828459045\dots.\]

4
HONPR1B/201/0

\bigskip
\item The determinant of the $3\times3$ matrix
\[A=\matriks{rrr}{2 & 1 & 0 \\ 1 & ~~1 & -1 \\ 0 & 1 & 2}\] is
\begin{eqnarray*}
|A|&=& \left|\begin{array}{rrr}2 & ~~1 & 0 \\
1 & 1 & -1 \\
0 & 1 & 2
\end{array}\right|\\[3mm]
&=& 2\left|\begin{array}{rr}1 & -1 \\
1 & 2
\end{array}\right|-
1\left|\begin{array}{rr}1 & -1\\
0 & 2
\end{array}\right| +
0\left|\begin{array}{rr}{1 & 1 \\
0 & 1}
\end{array}\right|\\[3mm]
&=& 2(2-(-1)) - (2-0) + 0 (1) \\[3mm]
&=& 4.
\end{eqnarray*}

\end{enumerate}

Question 3 [30]

The following is more or less what was expected from you. Note that the text and layout have sometimes
been adapted to comply with modern standards. The source code for each excerpt is shown in the shaded
box following it.

Excerpt 1

If x is a continuous variable with probability density function

1 (x−µ)2
f (x) = √ e −2σ2 with − ∞ < x < ∞,
σ 2π

then x is said to be a normally distributed variable with mean µ and variance σ 2 . We write this as

x ∼ N (µ, σ 2 ).

If $x$ is a continuous variable with {\it probability density function}


\[f(x)=\frac{1}{\sigma\sqrt{2\pi}}e^\frac{(x-\mu)^2}{-2\sigma^2}
\quad{\rm with}\quad -\infty<x<\infty,\]
then $x$ is said to be a normally distributed variable with mean $\mu$ and
variance $\sigma^2$. We write this as $$x \sim N(\mu,\,\sigma^2).$$

5
HONPR1B/201/0

Excerpt 2

Let ǫ1 be the minimum of kij − xij on all the forward arcs (i, j) of this path and let ǫ2 be the minimum of
xij on all the reverse arcs (i, j) of this path. We can define ǫ to be

ǫ = min(ǫ1 , ǫ2 ) > 0,

to obtain a new flow x′ = (x′ij ) with


(
ij + ǫ if (i, j) is a forward arc on the path,
x′ij =
xij − ǫ if (i, j) is a reverse arc on the path.

Let $\epsilon_1$ be the minimum of $k_{ij}-x_{ij}$ on all the forward arcs $(i,\,j)$
of this path and let $\epsilon_2$ be the minimum of $x_{ij}$ on all the reverse
arcs $(i,\,j)$ of this path. We can define $\epsilon$ to be
$$\epsilon=\min(\epsilon_1,\,\epsilon_2)>0,$$
to obtain a new flow $x’=(x_{ij}’)$ with
\[x_{ij}’=\left\{\begin{array}
x_{ij}+\epsilon\ {\rm if}\ (i,\,j)\ {\rm is\ a\ forward\ arc\ on\ the\ path},\\
x_{ij}-\epsilon\ {\rm if}\ (i,\,j)\ {\rm is\ a\ reverse\ arc\ on\ the\ path}.
\end{array}\right.\]

Excerpt 3

Consider the following loss function:

m
X k
X
p(x̄) = ϕ(gi (x̄)) + ξ(hj (x̄))
i=1 j=1
m
X k
X
= [max{0; gi (x̄)}]2 + [hj (x̄)]2 . (1)
i=1 j=1

Note that p(x̄) = 0 if x belongs to S and p(x̄) > 0 otherwise.

Consider the following loss function:


\begin{eqnarray}
p(\bar x)&=&\sum_{i=1}^m\psi(g_i(\bar{x}))+\sum_{j=1}^k\xi(h_j(\bar{x}))\nonumber\\
&=&\sum_{i=1}^m[\max\{0;\;g_i(\bar x)\}]^2+\sum_{j=1}^k[h_j(\bar{x})]^2.
\end{eqnarray}
Note that $p(\bar x)=0$ if $x$ belongs to $S$ and $p(\bar x)>0$ otherwise.

6
HONPR1B/201/0

Excerpt 4

From the definition1 we have


Z ∞
E(x) = x × 0,5e−0,5x dx.
0

We see that a = 0 and b = ∞ since the lower bound on x is obviously zero while the upper bound is infinite.
Evaluating, we have
Z ∞
E(x) = 0,5 xe−0,5x dx.
0

By using integration by parts with f (x) = x and g(x) = e0,5x , we find

1 −0,5x
Z
g(x)dx = − e .
0,5

From the definition\footnote{We no longer use $*$ for multiplication, since $\times$
is available in \LaTeX.} we have
$$E(x)=\int_0^\infty x\times0,5e^{-0,5x}{\rm d}x.$$
We see that $a=0$ and $b=\infty$ since the lower bound on $x$ is obviously zero while
the upper bound is infinite. Evaluating, we have
$$E(x)=0,5\int_0^\infty xe^{-0,5x}{\rm d}x.$$
By using integration by parts with $f(x)=x$ and $g(x)=e^{0,5x}$, we find
$$\int g(x){\rm d}x = -\frac{1}{0,5}e^{-0,5x}.$$

Excerpt 5

The profit table is shown in Table 1.

State of nature
Decision Licence No licence
Buy one $300 000 -$100 000
Do not buy one 0 0

Table 1: The profit table

1
We no longer use ∗ for multiplication, since × is available in LATEX.

7
HONPR1B/201/0

The profit table is shown in Table~\ref{table:one}.


\begin{table}[htb!]
\begin{center}
\begin{tabular}{|l|c|c|}
\hlx{hv[2]}
&\multicolumn{2}{c|}{\bf State of nature}\\
\hlx{v[2]c{2-3}v}
\multicolumn{1}{|c|}{\bf Decision}&Licence&No licence\\
\hlx{vhv}
Buy one & \$300\,000 & -\$100\,000\\
Do not buy one & 0 & 0\\
\hlx{vh}
\end{tabular}
\caption{\label{table:one}The profit table}
\end{center}
\end{table}

You might also like