Homework 9

CHE 116: Numerical Methods and Statistics

4/2/2020


1. Creating Matrices (6 Points)

Create the following matrices using the given constraints. 2 Points each.

  1. In 2 lines of python (not including prints/imports), create a 6x6 matrix whose second column (where we count "first", "second", etc.) is 3's and all other elements in the matrix are 1.
  2. Using a list comprehension, show how to get a compute a list containing the first 10 powers of pi.
  3. Use an f-string to print out exp(0.5) to 2 significant figures. Do the computation inside the {} in the f-string.

2. Matrix Calculations (10 Points)

Use the two matrices given to answer the following problems. Answer in Python.

$$A = \left[\begin{array}{lcr} 4 & -3 & 8\\ -3 & 4 & -4\\ 8 & -4 & 10\\ \end{array}\right]$$$$B = \left[\begin{array}{lcr} 1 & 5 & -1\\ 23 & -1 & -2\\ 1 & 2 & 3\\ \end{array}\right]$$
  1. [1 points] Report the rank of matrix $\mathbf{B}$ using Python.
  2. [1 points] Compute $\mathbf{BAB}$
  3. [2 points] What is the second eigenvalue of $\mathbf{B}$?
  4. [2 points] Solve $\mathbf{B}\vec{x} = \vec{b}$ where $\vec{b} = \left[11, 84, 17\right]$
  5. [1 points] Demonstrate your answer is correct for 2.4
  6. [2 points] Solve $\mathbf{A}\vec{x} = c\vec{x}$ for $x$ where $c$ is an arbitrary scalar.
  7. [1 points] Demonstrate your answer is correct for 2.6

3. Hypothesis Testing

  1. [1 point] If your p-value is 0.075 and $\alpha = 0.1$, should you reject the null hypothesis?
  2. [1 point] What is your p-value if your $T$-value is -3 in the two-tailed/two-sided $t$-test with a DOF of 5?
  3. [4 points] For a one-sample $zM$ test, what is the minimum number of standard deviations away from the population mean a sample should be to reject the null hypothesis with $\alpha = 0.05$? Set-up the equation for this (2 points) and compute the answer (2 points). Hint: your equation should have an integral on one side and you'll need to use ppf to compute
  4. [3 points]For an N-sample $zM$ test, what is the minimum number of standard deviations away from the population mean a sample should be to reject the null hypothesis with $\alpha = 0.05$ in terms of $N$? Report this answer with one digit of precisions. Modify your equation from 3.3 (2 points) and compute the answer (2 points). This is an important expression to memorize
  5. [1 point] In a Poisson hypothesis test (single-sided), what is the p-value if $\mu = 3$ and the sample value is 20? Hint: think about what you would expect the p-value to be
  6. [1 point] What is the p-value for a student t-test with $\bar{x} = 2$, $\sigma_x = 0.8$, $\mu=2.4$, and $N = 11$?