diff --git a/programming/exercises/matrices.tex b/programming/exercises/matrices.tex index 4cf7bcc..84127a4 100644 --- a/programming/exercises/matrices.tex +++ b/programming/exercises/matrices.tex @@ -159,7 +159,7 @@ following pattern: \code{x(randi(100, 50, 1)])} \end{solution} - \part Can you imagine an advantage of using linear indexing instead of subscript indexing? + \part Can you imagine an advantage of using linear instead of subscript indexing? \begin{solution} Die Matrize ist 2-dimensional. Wenn mit dem subscript index zugegriffen werden soll, dann muss auf die Dimensionen @@ -215,7 +215,7 @@ following pattern: \question Create a 3-D matrix from two 2-D matrices. Use the function \code{cat} (check the help to learn its usage). \begin{parts} - \part Select all elements of the first ``page'' (index 1, 3. dimension). + \part Select all elements of the first ``page'' (index 1 in the 3. dimension). \begin{solution} \code{x = randn(5,5); \\y = randn(5, 5);\\ z = cat(3, x, y);\\disp(z(:,:,1))} \end{solution} diff --git a/programming/exercises/variables_types.tex b/programming/exercises/variables_types.tex index 5e61afc..956026f 100644 --- a/programming/exercises/variables_types.tex +++ b/programming/exercises/variables_types.tex @@ -1,6 +1,6 @@ \documentclass[12pt,a4paper,pdftex]{exam} -\usepackage[german]{babel} +\usepackage[english]{babel} \usepackage{natbib} \usepackage{graphicx} \usepackage[small]{caption} @@ -171,7 +171,7 @@ following pattern: ``variables\_datatypes\_\{lastname\}.m'' \question Floating point numbers I: Limited precision during additions \begin{parts} - \part Create the variable \code{a} and assign an arbitrary floting point number. + \part Create the variable \code{a} and assign an arbitrary floating point number. \begin{solution} \code{a = 3.14;} \end{solution} @@ -185,12 +185,17 @@ following pattern: ``variables\_datatypes\_\{lastname\}.m'' Result is 0! Even with doubles there is a limited precision in the decimal part. \end{solution} - \part Calculate \verb=(2^52 + 1) - 2^52= and + \part Calculate \verb=(2^52 + 1) - 2^52=, \verb=(2^53 + 1) - 2^53=. \begin{solution} First command results in = 1, in the second case = 0. With such high numbers, small differences (1!) cannot be resolved. \end{solution} + \part Same as before, but add larger numbers (100 and 101, for example). + \begin{solution} + The difference between 100 and 101 cannot be resolved, so it is + the delta, not the absolute value that is important. + \end{solution} \part Calculate \code{sqrt(1+1e-16)-1}. Is the result correct? Why (not)? \begin{solution} Square root of something larger than 1 should not be 1 and thus