<jupyter_start><jupyter_text>Quiz 3For Penn State student, access quiz [here](https://psu.instructure.com/courses/2177217)<jupyter_code>import ipywidgets as widgets<jupyter_output><empty_output><jupyter_text>Question 1Is $f(x)=e^x$  a convex function?  ```{dropdown} Show answerAnswer: Yes```  Question 2Consider the uniform distribution $\mathcal X$ on $[-a,a]$ for some number $a>0$. What are the expectation and variance of $\mathcal X$ ```{dropdown} Show answerAnswer:$0,   \frac{a^2}{3}.$```  Question 3Suppose you flip a fair icon 3 times. Let $\chi$ be the number of heads. Calculate the expectation of $\chi ^2 $ ```{dropdown} Show answerAnswer: 3```  Question 4Consider the function $f(x,y,z)=yz+e^{xyz}$. At the point $    \begin{pmatrix}    x\\    y\\    z    \end{pmatrix}    =    \begin{pmatrix}    0\\    1\\    2    \end{pmatrix}$find the direction along which the function decreases most rapidly. ```{dropdown} Show answerAnswer: $\begin{pmatrix} -2\\-2\\-1\end{pmatrix}$```  Question 5Consider $f(x,y)=2x^2+2y^2.$ Given initial guess $    \begin{pmatrix}    x^0\\    y^0    \end{pmatrix}    =    \begin{pmatrix}    2\\    3    \end{pmatrix}$$\eta =1/8$ compute two steps of the gradient  descent method for $f(x,y)$ ```{dropdown} Show answerAnswer: $    \begin{pmatrix}    x^2\\    y^2    \end{pmatrix}    =    \begin{pmatrix}    \frac {1}{2}\\    \frac {3}{4}    \end{pmatrix}$```  Question 6What is output of the following code?<jupyter_code>class test:
        def _ _init_ _(self, a):
               self.a=a
        def display(self):
               print(self.a)
obj = test()
obj.display()<jupyter_output><empty_output><jupyter_text>```{dropdown} Show answerAnswer: Error as one argument is required while creating the object```  Question 7If we use "import Course'' in Python, what is "Course"? ```{dropdown} Show answer    Answer: A module```  Question 8What is the output of the following code:<jupyter_code>print('{}\n/{}'.format(1,2))<jupyter_output><empty_output><jupyter_text>```{dropdown} Show answerAnswer: 1/2```  Question 9How to define stochastic gradient descent method with learing rate=1 after:<jupyter_code>import torch.optim
import torch.nn as nn
my_model=nn.Linear(784,10)<jupyter_output><empty_output>