====
Solve this system of equations using the linalg
package. Answer in Python.
===
A set of frist-order chemical reactions can be described by the following system of differential equations:
$$\begin{array}{lr} \cfrac{dC_1(t)}{dt} = & -2 C_1(t) + C_2(t) + C_3(t)\\ \cfrac{dC_2(t)}{dt} = & 2 C_1(t) - 4 C_2(t)\\ \cfrac{dC_3(t)}{dt} = & 3 C_2(t) - C_3(t)\\ \end{array}$$Answer the following questions:
linalg
.====
All your functions must have docstrings for full credit.
[4] Create a button and text input, where the value of the text box is printed out. Make it so that the output area is cleared each time the button is pressed.
[4] Create a button that prints a random integer from 0 to 10 using the random.randint
function.
[4] Make a list of strings. Using your button from part 2, now have it print a random string from your list.
[8] Take the following matrix: [[3, 2, -6], [2, 6, 4], [3, 4, 0]]
and use an interaction widget to display its eigenvalues and eigenvectors. Your slider should go from 0 to 2 and each value should result in a latex display showing the eigenvalue and eigenvector. Note that Python eats {}
in strings, so you'll have to use {{}}
. This is called escaping. Python also eats many things that have a backslash. For example, \b
means backspace to python. And \\
means \
in python. So you'll have to write \\
when you want LaTeX to see \
and in general use some trial in error about backslashes. You can never have too many though! For example, write \\begin{{array}}
to start your matrix. Use three ''' for example'''
to have a string that spans multiple lines. Summary comic. Practice getting the LaTeX correct before putting it all together.
====
Compute the following integrals using scipy
. Report all your answers using display.Latex
and only three decimal places.
Integrate the normal distribution with $\sigma = 2$, $\mu = -4$ from $-2$ to $2$. Do not use scipy.stats
===
data_5_x = [0.0, 0.2857, 0.5714, 0.8571, 1.1429, 1.4286, 1.7143, 2.0, 2.2857, 2.5714, 2.8571, 3.1429, 3.4286, 3.7143, 4.0, 4.2857, 4.5714, 4.8571, 5.1429, 5.4286, 5.7143, 6.0, 6.2857, 6.5714, 6.8571, 7.1429, 7.4286, 7.7143, 8.0, 8.2857, 8.5714, 8.8571, 9.1429, 9.4286, 9.7143, 10.0, 10.2857, 10.5714, 10.8571, 11.1429, 11.4286, 11.7143, 12.0, 12.2857, 12.5714, 12.8571, 13.1429, 13.4286, 13.7143, 14.0]
data_5_y = [67.9925, 67.5912, 67.4439, 66.7896, 66.4346, 66.3176, 65.7527, 65.1487, 65.7247, 65.1831, 64.5981, 64.5213, 63.6746, 63.9106, 62.6127, 63.3892, 62.6511, 62.601, 61.9718, 60.5553, 61.5862, 61.3173, 60.5913, 59.7061, 59.6535, 58.9301, 59.346, 59.2083, 60.3429, 58.752, 57.6269, 57.5139, 59.0293, 56.7979, 56.2996, 56.4188, 57.1257, 56.1569, 56.3077, 55.893, 55.4356, 56.7985, 55.6536, 55.8353, 54.4404, 54.2872, 53.9584, 53.3222, 53.2458, 53.7111]