We saw many optimization algorithms. Collect all the cells which gave a summary of the different techniques and paste them into your homework below. An example is given below:
Type: Root Finding
Discrete/Continuous: Continuous
Dimensions: 1
Derivative: optional
Convex: yes
Python: newton
Your primary grade teacher gives you a piece of cardboard that has dimensions: 4 cm by 3 cm. You are supposed to cut the corners as shown below and fold up the corners to make an open box. Determine the height of the box that gives a maximum volume. See the picture below of the box
In [1]:
from IPython.display import Image
Image(url="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQIAAADDCAMAAABeUu/HAAAAA3NCSVQICAjb4U/gAAAAflBMVEX/\
//9sbGylpaXW1tbZ2dmhoaEAAAD5+fn19fXk5OT8/PzQ0NDy8vLc3NzKysrs7Oy0tLS9vb2KiorF\
xcW4uLg9PT14eHiZmZmurq5UVFQ2NjYiIiJxcXEpKSlZWVmSkpJ/f39kZGQwMDAcHBxYWFhISEhL\
S0t8fHxBQUETExNOLLFOAAAACXBIWXMAAA+IAAAPiAEWyKWGAAAF80lEQVR4nO2di3ajKhSG/0SD\
4o0Y02jubabttO//ggd6mZ5LdTwwIOr+V1aWWUZLv2xgw4YtQCJ5qOT+aegiDK2QzR1Bsru+DF2G\
gbXY1ndDl2FYBQzXmSO4r2aP4CWaO4L9Ig93hzAauhwDas/elA9djgEVRRE2864ISjNvC5Tq/dAl\
IJFIJBKJRCKRSCRSp6Jg0uozOxNelhNWc+iDYGlqR17r1OM74Urv3pXbOVCuOd+46PEdXQQ80btO\
U1mmd51NBCORTQSrWO86TaWF3nVkBYSAKgLICmAXgWYnpatI0w2xiWDt1jXKA73rqCJYRRC4tQLB\
9a6zisCtgyyE3nVUEawiaNxWhNDD5tCtZ+RlpzgSkYNMVkAIYBfB8qMiVIU00bJK9e7SpbyqMgRV\
+eaABJp/wIUV1KwCNiw0u8t34myRyLed0U2cTJ9ezzHsrCfNWInF9ePYQ++w+Oyoc7ZsNP2W3yhZ\
MFF/HHMPxwhf4vLHsqR9n0hIp2wi+AqlrB7PdqwA/Hz6ZOBjKEV8t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-0.92, -1.53, -1.94, -1.75, -2.37, -2.09, -2.99, -3.04, -2.85, -2.66, -3.03, -3.39, -3.36, -3.7, -4.41, -4.7, -4.51, -4.29, -5.39, -4.81, -5.63, -5.01, -5.79, -6.03, -6.04, -6.35, -6.82, -6.48, -6.6, -6.69, -7.05, -7.4, -8.07, -7.81, -7.97, -8.08, -8.29, -8.99, -9.17, -9.38, -9.1, -9.62, -9.85, -9.99, -9.64, -10.78, -10.76, -10.84, -11.1, -11.03, -11.48, -11.47, -11.4, -11.58, -11.77, -11.97, -12.1, -12.65, -12.52, -12.79, -13.21, -13.24, -13.85, -13.5, -13.9, -14.66, -14.44, -14.65, -14.72, -14.7, -14.87, -15.47, -15.21, -15.82, -16.37, -16.42, -16.67, -16.52, -16.62, -17.39, -16.94, -17.48, -18.17, -18.31, -17.75, -17.86, -18.6, -18.43, -19.04, -19.1, -18.83]
In the following cell there is a function which takes in data, a known trial number, and a proposed success probability. It then returns how well the binomial distribution fits the data. Complete the program so that it finds the optimal success probability
In [1]:
from scipy.special import comb
import numpy as np
bin_data = [4, 3, 6, 1, 2, 1, 1, 1, 3, 0, 4, 2, 4, 2, 2, 3, 2, 4, 4, 3]
N = 20
def bin_fit(p, data, N):
fit = 0
for di in data:
fit += np.log( comb(N, di) * (1 - p)**(N - di) * p**di )
return fit
#Example of how to use
print bin_fit(0.8, bin_data, N)
The follow reaction occurs in water and is highly exothermic ($\Delta$H = $863.9$ BTU / lb-mol):
$$\textrm{AB}\rightarrow \textrm{A}^+ + \textrm{B}^-$$Its equilibrium constant has been shown to fit the following empirical relationship from 400 $^\circ{}$ R to 800 $^\circ{}$ R:
$$ k = Ae^{\frac{-B}{RT}} + C\left(\frac{B}{RT} - 0.5\right)^2 $$where $A = 10^{1} $ lb-mol / gal, $B = 500$ BTU, $C = 10^{-3}$ lb-mol / gal, $T$ is temperature and $R$ is the universal gas constant.
I add 1.5 lb-mol of AB to a 25.0 gal tank of water which is at 510.0 $^\circ{}$R. Assume that the heat capacity of the tank is well-apprximated by that of water, 17.89 BTU / (lb-mol $^\circ{}$ R) and that all reaction enthalpy goes to heating the solution. How much AB remains in lb-mol and what is the final temperature of the solution?
The time between eruptions at a volcano is exponentially distributed with a rate of 1 eruption every 10 years. There is a nearby city. Each time the volcano erupts, everyone dies in the city except for 1 person. People gradually come back. If a volcano erupted at $t=0$, the population can be modeled by: $$N(t) = e^{0.9t}$$
Write down $P(N)$ in markdown using equiations from Unit 8. You must only set-up the integral that finds $P(N)$. Do not evaluate the integral.
In [ ]: