exercises

\[ \def\P{\mathbf{P}} \def\O{\emptyset} \def\R{\mathbb{R}} \def\E{\mathbf{E}} \def\D{\mathbf{D}} \def\cov{\rm{cov}} \def\corr{\rm{corr}} \]

ex 1
  • define the function $f(x)=x(2-7x)$ and its first and second derivative.

  • plot them in the same window over the interval $[-2,2]$



ex 1 - output



ex 2
  • define the vector $[1,2,1,2,1,\ldots,]$ with lengths $10,11,\ldots,20$



ex 2 - hint
  • define an arbitrary two period sequence first, then transform it

  • feel free to use modulo/power operations

  • one possibility: $((-1).^(1:n) + 1)/2 + 1$




ex 3
  • define the vector $[1,2,4,2,1,2,4,2,1,2\ldots,]$ with lengths $10,11,\ldots,20$



ex 3 - hint
  • it can be solved with (very) basic operations, but it is worth to know, that:

    • there is function that repeats its argument: repmat




ex 4
  • define the function $f(x)=x^5 - 10x + 2$

  • plot it over $[-2,2]$

  • how many real roots does it have? (explain)



ex 4 - output+hint
  • roots: consider the derivative before/after $-2,2$

  • what is the sign of $x^4-10$ if $x\lt -2$ or $x\gt 2$?




ex 5
  • define the matrices $A_2,A_3,A_4,\ldots$ with different sizes:

\[ \left[ \begin{array}{cc} 0 & 1\\1 & 0 \end{array}\right] , \left[ \begin{array}{ccc} 0 & 1 & 1\\1 & 0 & 1\\1 & 1 & 0 \end{array}\right] , \left[ \begin{array}{cccc} 0 & 1 & 1 & 1\\1 & 0 & 1 & 1\\1 & 1 & 0 & 1\\1 & 1 & 1 & 0 \end{array}\right] ,\ldots \]

  • what is the rank of $A_{33}$ ?

  • how many solutions do we have for the system below?

\[ A_{33}x=\left[ \begin{array}{c} 0\\0\\\vdots\\0\\0 \end{array}\right] \]



ex 5 - hint
  • computer based solution: define the matrix and call rank

  • starting with a canonical basis you can transform it to the columns of the desired matrix, but we need here som arguments that the transformation preserves the rank...




ex 6

There are 3 brothers. They like each other so much, that at the ends of days they share their earnings according the rules:

  • A gives 40% and 50% of his money to B and C.

  • B gives 55% and 30% of his money to A and C.

  • C gives 30% and 60% of his money to A and B.

They earn 10 gold per day and initially they have no money at all.

  • how much gold A will have at the end of the day 10?



ex 6 - hint+answer
  • define a matrix that describes the process of sharing gold, use loop to simulate 10 days of sharing, do not forget to administer the incomes!

  • the answer is 97.859 (approximately)




ex 7

Let $z=3-4i$ and $n=7$. Compute all the $n$-th roots of $z$ ($z_0,\ldots,z_{n-1}$)

  • What is $z_0+\ldots +z_{n-1}$?

  • repeat the process w/ different $z$ and $n$. what is your observation? can you explain?



ex 7 - hint
  • arbitrary -> unit-length -> unit

  • use identity: $x^n -1 = (x-1)(x^{n-1}+x^{n-2}+\ldots+x+1)$




ex 8

Peter has some coins w/ denominations $1,5$ and $d$. Yes, we do not know what is the largest one. But, we know that, the sum of his money is 130 and the number of coins he has is 15 and he has from each denominations at least one, and lastly, the number of unknown type coins is exactly the half of the other types.

  • what is the the smallest possible (integer) denomination?



ex 8 - hint+answer
  • brute force application of \

(20, Rational{Int64}[5//1, 5//1, 5//1])




ex 9

A particle moves along the x-axis. The function $s(t) = s_0 + v_0 t + \frac{a}{2} t^2$ gives its signed distance from the origin at any time. We observed it at $t=1,2,3$ and got the distances 2, 3, 10.

  • what is $s(4)$?



ex 9 - hint+answer
  • set up a linear system based on the data.

  • $s(4)=$ 23