Programming Assignments
Main.CourseHomework History
Hide minor edits - Show changes to output
Changed line 120 from:
Complete the following assignments with Microsoft Excel or Google Sheet (1-6) and Python for (1-17). The first 6 assignments are the same problems but completed with both a Spreadsheet program (Excel or Google Sheets) and Python. Solutions are shown for each problem but should only be used as a learning resource, not to merely complete the assignment.
to:
Complete the following assignments with Microsoft Excel or Google Sheet (1-6) and Python for (1-17). The first 6 assignments are the same problems but completed with both a Spreadsheet program (Excel or Google Sheets) and Python. Solutions are shown for each problem but should only be used as a learning resource, not to merely complete the assignment. [[https://byu.zoom.us/j/98961977317|Join Online]] for homework help sessions.
Changed lines 337-339 from:
[[https://youtu.be/oCr2eUIYznc|Python Solutions]]
to:
[[https://youtu.be/oCr2eUIYznc|Python Solutions 1-2+]]
[[https://youtu.be/hOhjNvnrwZA|Python Solution 3]]
[[https://youtu.be/hOhjNvnrwZA|Python Solution 3]]
Added lines 256-257:
[[https://youtu.be/1C5zn0OzItM|Python Solution]]
Added lines 241-242:
[[https://youtu.be/Nvie0LZwMSM|Python Solution 2]]
Added lines 239-240:
[[https://youtu.be/YCQfT-S93FI|Python Solution 1]]
Added lines 224-225:
[[https://youtu.be/Z2zUGmqIDto|Python Solution 3]]
Added lines 222-223:
[[https://youtu.be/uoshfzYW6vA|Python Solution 2]]
Added lines 220-221:
[[https://youtu.be/4vryPwLtjIY|Python Solution 1]]
Added lines 197-198:
[[https://youtu.be/pxaThR0mQR4|Python Solution 4]]
Added lines 195-196:
[[https://youtu.be/EIgP6Q20xm8|Python Solution 3]]
Added lines 193-194:
[[https://youtu.be/nnCDaHCulAU|Python Solution 2]]
Added lines 191-192:
[[https://youtu.be/NO20jcoHH4I|Python Solution 1]]
Added lines 172-173:
[[https://youtu.be/b9pLyNc1sy0|Python Solution 3]]
Added lines 168-169:
[[https://youtu.be/azF79AUgx1g|Python Solution 1]]
Added lines 147-148:
[[https://youtu.be/1p3U79HfobM|Python Solution]]
Changed lines 124-126 from:
(:table border=0 frame=hsides width=95%:)
(:cell width=10%:)
(:cell width=
to:
(:table border=0 frame=hsides width=100%:)
(:cell width=5%:)
(:cell width=5%:)
Changed line 131 from:
(:cell width=30%:)
to:
(:cell width=35%:)
Changed lines 120-122 from:
!!!!Excel Assignments
Complete the following assignments with Microsoft Excel, Google Sheets, or another similar spreadsheet program. Microsoft Excel solutions are shown for each problem but should only be used as a learning resource, not to merely complete the assignment. Python solutions are shown as examples of programming but are not required.
Complete the following assignments with Microsoft Excel
to:
!!!!Excel and Python Assignments
Complete the following assignments with Microsoft Excel or Google Sheet (1-6) and Python for (1-17). The first 6 assignments are the same problems but completed with both a Spreadsheet program (Excel or Google Sheets) and Python. Solutions are shown for each problem but should only be used as a learning resource, not to merely complete the assignment.
Complete the following assignments with Microsoft Excel or Google Sheet (1-6) and Python for (1-17). The first 6 assignments are the same problems but completed with both a Spreadsheet program (Excel or Google Sheets) and Python. Solutions are shown for each problem but should only be used as a learning resource, not to merely complete the assignment.
Added lines 137-138:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW01.ipynb|Google Colab 1]]
Added lines 154-155:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW02.ipynb|Google Colab 2]]
Added lines 173-174:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW03.ipynb|Google Colab 3]]
Added lines 196-197:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW04.ipynb|Google Colab 4]]
Added lines 211-212:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW05.ipynb|Google Colab 5]]
Added lines 224-225:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW06.ipynb|Google Colab 6]]
Deleted line 145:
Changed lines 163-164 from:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW02.ipynb|Python Solutions]]
to:
[[https://youtu.be/vjCctma5dYg|Python Solution 2]]
Deleted line 179:
Deleted line 198:
Deleted line 209:
Deleted line 220:
Changed lines 301-303 from:
[[https://youtu.be/oCr2eUIYznc|Python Solutions 1-2]]
[[https://youtu.be/vjCctma5dYg|Python Solution 3]]
[[https://youtu.be/vjCctma5dYg|Python Solution 3]]
to:
[[https://youtu.be/oCr2eUIYznc|Python Solutions]]
Changed lines 126-127 from:
(:cell width=25%:)
to:
(:cell width=10%:)
(:cell width=30%:)
(:cell width=30%:)
Deleted lines 128-129:
'''Knowledge Building'''
Added lines 130-131:
'''Knowledge Building'''
(:cell width=30%:)
(:cell width=30%:)
Deleted lines 132-133:
Added lines 134-135:
''''+1+''''
(:cell:)
(:cell:)
Deleted lines 146-147:
Added lines 148-149:
''''+2+''''
(:cell:)
(:cell:)
Deleted lines 164-165:
Added lines 166-167:
''''+3+''''
(:cell:)
(:cell:)
Deleted lines 180-181:
Added lines 182-183:
''''+4+''''
(:cell:)
(:cell:)
Added lines 202-203:
''''+5+''''
(:cell:)
(:cell:)
Added lines 214-215:
''''+6+''''
(:cell:)
(:cell:)
Added lines 226-227:
''''+7+''''
(:cell:)
(:cell:)
Added lines 245-246:
''''+8+''''
(:cell:)
(:cell:)
Added lines 257-258:
''''+9+''''
(:cell:)
(:cell:)
Added lines 273-274:
''''+10+''''
(:cell:)
(:cell:)
Added lines 285-286:
''''+11+''''
(:cell:)
(:cell:)
Added lines 297-298:
''''+12+''''
(:cell:)
(:cell:)
Added lines 309-310:
''''+13+''''
(:cell:)
(:cell:)
Added lines 321-322:
''''+14+''''
(:cell:)
(:cell:)
Added lines 335-336:
''''+15+''''
(:cell:)
(:cell:)
Added lines 347-348:
''''+16+''''
(:cell:)
(:cell:)
Added lines 357-358:
''''+17+''''
(:cell:)
(:cell:)
Changed lines 230-236 from:
[[https://youtu.be/r7C2Hu1Qtgg|Solution 1]]
[[https://youtu.be/YugOojaknDM|Solution 2]]
[[https://youtu.be/L7scElJU36s|Solution 3]]
[[https://youtu.be/p2Dyx9DyQWw|Soluiton 4]]
[[https://youtu.be/YugOojaknDM|Solution 2]]
[[https://youtu.be/L7scElJU36s|Solution 3]]
[[https://youtu.be/p2Dyx9DyQWw|
to:
[[https://youtu.be/r7C2Hu1Qtgg|Python Solution 1]]
[[https://youtu.be/YugOojaknDM|Python Solution 2]]
[[https://youtu.be/L7scElJU36s|Python Solution 3]]
[[https://youtu.be/p2Dyx9DyQWw|Python Solution 4]]
[[https://youtu.be/YugOojaknDM|Python Solution 2]]
[[https://youtu.be/L7scElJU36s|Python Solution 3]]
[[https://youtu.be/p2Dyx9DyQWw|Python Solution 4]]
Changed lines 250-251 from:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW09.ipynb|Google Colab 9]](:cell:)
to:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW09.ipynb|Google Colab 9]]
(:cell:)
(:cell:)
Changed line 151 from:
[[Attach:tclab.txt|Problem 2 Data File]]
to:
[[Attach:tclab.txt|Problem 2 Data]]
Changed lines 199-200 from:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW03.ipynb|Python Solutions]]
to:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW04.ipynb|Python Solutions]]
Changed lines 209-210 from:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW04.ipynb|Python Solutions]]
to:
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW05.ipynb|Python Solutions]]
Added line 211:
[[Attach:hw6.pdf|Assignment #6]]
Added line 213:
[[Main/VbaMacro|VBA Macros]]
Changed lines 215-216 from:
to:
[[https://youtu.be/bHwFTDp5g6A|Excel Solution 1]]
[[https://youtu.be/0C6QMin5OZc|Excel Solution 2]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW06.ipynb|Python Solutions]]
[[https://youtu.be/0C6QMin5OZc|Excel Solution 2]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW06.ipynb|Python Solutions]]
Added lines 221-224:
[[Attach:hw7.pdf|Assignment #7]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW07.ipynb|Google Colab 7]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW07.ipynb|Google Colab 7]]
Added lines 226-228:
[[Main/PythonConditionals|Conditionals]]
[[Main/PythonFunctions|Functions]]
[[Main/PythonFunctions|Functions]]
Changed lines 230-231 from:
to:
[[https://youtu.be/r7C2Hu1Qtgg|Solution 1]]
[[https://youtu.be/YugOojaknDM|Solution 2]]
[[https://youtu.be/L7scElJU36s|Solution 3]]
[[https://youtu.be/p2Dyx9DyQWw|Soluiton 4]]
[[https://youtu.be/YugOojaknDM|Solution 2]]
[[https://youtu.be/L7scElJU36s|Solution 3]]
[[https://youtu.be/p2Dyx9DyQWw|Soluiton 4]]
Added lines 238-240:
[[Attach:hw8.pdf|Assignment #8]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW08.ipynb|Google Colab 8]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW08.ipynb|Google Colab 8]]
Added lines 242-244:
[[Main/PythonLoops|Loops]]
[[Main/PythonArrays|Arrays]]
[[Main/PythonArrays|Arrays]]
Changed lines 246-247 from:
to:
[[https://youtu.be/2Y6aMjBYPww|Python Solutions]]
Added lines 248-251:
[[Attach:hw9.pdf|Assignment #9]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW09.ipynb|Google Colab 9]](:cell:)
[[Main/PythonPlots|Generate Plots]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW09.ipynb|Google Colab 9]](:cell:)
[[Main/PythonPlots|Generate Plots]]
Changed lines 253-255 from:
to:
[[https://youtu.be/ziRNzO1T-Mo|Python Solution 1]]
[[https://youtu.be/Ql8QPcp8818|Python Solution 2]]
[[https://youtu.be/6r5JZjokp-0|Python Solution 3]]
[[https://youtu.be/G0ceVjin_cg|Python Solution 4]]
[[https://youtu.be/Ql8QPcp8818|Python Solution 2]]
[[https://youtu.be/6r5JZjokp-0|Python Solution 3]]
[[https://youtu.be/G0ceVjin_cg|Python Solution 4]]
Added lines 261-263:
[[Attach:hw10.pdf|Assignment #10]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW10.ipynb|Google Colab 10]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW10.ipynb|Google Colab 10]]
Added line 265:
[[https://apmonitor.com/heat.htm|Temperature Control Lab]]
Changed lines 267-268 from:
to:
[[https://youtu.be/vY9Sv605E8c|Python Solution 1]]
[[https://youtu.be/ygoohjN_Lww|Python Solution 2]]
[[https://youtu.be/ygoohjN_Lww|Python Solution 2]]
Added lines 271-273:
[[Attach:hw11.pdf|Assignment #11]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW11.ipynb|Google Colab 11]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW11.ipynb|Google Colab 11]]
Added line 275:
[[Main/PythonDebug|Debugging]]
Changed lines 277-278 from:
to:
[[ https://youtu.be/ezuRn1ViIJE|Python Solutions 1-5]]
[[https://youtu.be/8SNaW1nt6j0|Python Solution 6]]
[[https://youtu.be/8SNaW1nt6j0|Python Solution 6]]
Added lines 281-283:
[[Attach:hw12.pdf|Assignment #12]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW12.ipynb|Google Colab 12]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW12.ipynb|Google Colab 12]]
Added line 285:
[[Main/PythonDataAnalysis|File Input and Output]]
Changed lines 287-288 from:
to:
[[https://youtu.be/oCr2eUIYznc|Python Solutions 1-2]]
[[https://youtu.be/vjCctma5dYg|Python Solution 3]]
[[https://youtu.be/vjCctma5dYg|Python Solution 3]]
Added lines 291-293:
[[Attach:hw13.pdf|Assignment #13]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW13.ipynb|Google Colab 13]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW13.ipynb|Google Colab 13]]
Added line 295:
[[https://youtu.be/LwOg0b0ZwCM|Classes (collections of values and functions)]]
Changed lines 297-298 from:
to:
[[https://youtu.be/ntyGGOiOD9w|Python Solutions 1]]
[[https://youtu.be/mV9HECu07z8|Python Solutions 2]]
[[https://youtu.be/mV9HECu07z8|Python Solutions 2]]
Added lines 301-303:
[[Attach:hw14.pdf|Assignment #14]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW14.ipynb|Google Colab 14]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW14.ipynb|Google Colab 14]]
Added line 305:
[[Main/PythonSolveEquations|Solve Equations]]
Changed lines 307-308 from:
to:
[[https://youtu.be/v4R6K4RxADE|Python Solutions 1-2]]
[[https://youtu.be/66hOMWZec10|Python Solution 3]]
[[https://youtu.be/Y7YBPqGKr9Y|Python Solution 4]]
[[https://youtu.be/66hOMWZec10|Python Solution 3]]
[[https://youtu.be/Y7YBPqGKr9Y|Python Solution 4]]
Added lines 313-315:
[[Attach:hw15.pdf|Assignment #15]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW15.ipynb|Google Colab 15]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW15.ipynb|Google Colab 15]]
Added line 317:
[[Main/PythonDataRegression|Data Regression]]
Changed lines 319-320 from:
to:
[[https://youtu.be/4grhQ5Y_MWo|Python Solution 1]]
[[https://youtu.be/Lj_-7xIGkeI|Python Solutions 2-4]]
[[https://youtu.be/Lj_-7xIGkeI|Python Solutions 2-4]]
Added lines 323-325:
[[Attach:hw16.pdf|Assignment #16]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW16.ipynb|Google Colab 16]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW16.ipynb|Google Colab 16]]
Added line 327:
[[Main/PythonDynamicSim|Solve Differential Equations]]
Changed lines 329-330 from:
to:
[[https://youtu.be/BRe7qKIAa34|Python Solution]]
Added lines 331-333:
[[Attach:hw17.pdf|Assignment #17]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW17.ipynb|Google Colab 17]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW17.ipynb|Google Colab 17]]
Added lines 335-337:
[[https://youtu.be/SFI_l96Oss4|Symbolic Derivatives]]
[[https://youtu.be/4grhQ5Y_MWo|Integrals]]
[[https://youtu.be/4grhQ5Y_MWo|Integrals]]
Changed lines 339-360 from:
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
to:
[[https://youtu.be/EaYEQ30KlWw|Python Solution]]
Deleted lines 340-1144:
*[[Attach:hw1.pdf|Assignment #1]]
** [[Main/ExcelConditionals|Conditionals]]
** [[Main/ExcelFunctions|Functions]]
** Excel [[https://youtu.be/VPjoNrtm8wk|Solution 2]], [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
** (:toggle hide hw1_2 button show="Solution 2 (Python)":)
(:div id=hw1_2:)
(:source lang=python:)
# constants
L = 2 # m
Tplate = 343 # K
v = 1.45 # m/s
Twater = 294 # K
mu = 9.79e-4 # Pa*s
rho = 998 # kg/m^3
k = 0.601 # W/m-K
cp = 4.18e3 # J/kg-K
# derived quantities
Re = rho*L*v/mu
Pr = mu*cp/k
Nu = 0.332 * Pr**(1.0/3.0) * Re**(1.0/2.0)
h = Nu * k / L
q = h * (Tplate-Twater)
print('Rate of Heat Transfer')
print(str(q)+' W/m^2')
(:sourceend:)
(:divend:)
** (:toggle hide hw1_3 button show="Solution 3 (Python)":)
(:div id=hw1_3:)
%width=500px%Attach:pressure_contour.png
(:source lang=python:)
import numpy as np
import matplotlib.pyplot as plt
# calculate initial moles of N2
T = 298.15 # K
P = 1.25 # atm
V = 4000 # L
Rg = 0.0821 # L*atm/mol/K
n_N2 = P*V/(Rg*T) # moles of N2
n_N2 = n_N2 * 0.25 # moles with 25% remaining
# calculate N2 pressure at different V and T
n = 20 # grid points
V = np.linspace(500,1000,n)
T = np.linspace(100,600,n)
# create meshgrid
Vm,Tm = np.meshgrid(V,T)
# calculate pressure
Pm = n_N2 * Rg * Tm / Vm
# plot results
plt.figure()
plt.contourf(Vm,Tm,Pm,cmap='RdBu_r')
plt.colorbar()
CS2 = plt.contour(Vm,Tm,Pm,[1.0,2.5],colors='k')
plt.clabel(CS2, inline=1, fontsize=10)
plt.xlabel('Volume (L)')
plt.ylabel('Temperature (K)')
plt.show()
(:sourceend:)
(:divend:)
*[[Attach:hw2.pdf|Assignment #2]] - [[Attach:tclab.txt|Problem 2 Data File]]
** [[Main/ExcelScatterPlots|Generate Plots]]
** [[Main/ExcelDataAnalysis|Data Analysis]]
** Excel [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/6vFynd2bGoQ|Solution 2]], [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
** (:toggle hide hw2_1 button show="Solution 1 (Python)":)
(:div id=hw2_1:)
(:source lang=python:)
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# import April 2018 data or get new data from finance.yahoo.com
appl = pd.read_csv('https://apmonitor.com/che263/uploads/Main/AAPL.csv')
goog = pd.read_csv('https://apmonitor.com/che263/uploads/Main/GOOG.csv')
#xom = pd.read_csv('https://apmonitor.com/che263/uploads/Main/XOM.csv')
# create dictionary of stocks
s = dict([('Apple',appl),('Google',goog)]) #,('ExxonMobil',xom)])
# print column headers and starting rows (5 is default)
print('Apple Data')
print(s['Apple'].head())
# print column headers and ending close price (4 rows)
print('Google Data')
print(s['Google']['Close'].tail(4))
# basic data statistics
for i in s:
print('Stock: ' + i)
print(' max : ' + str(max(s[i]['Close'])))
print(' min : ' + str(min(s[i]['Close'])))
print(' stdev : ' + str(np.std(s[i]['Close'])))
print(' avg : ' + str(np.mean(s[i]['Close'])))
print(' median: ' + str(np.median(s[i]['Close'])))
# plot data
plt.figure()
sty = dict([('Apple','r--'),('Google','b:'),('ExxonMobil','k-')])
ni = 0
for i in s:
mc = max(s[i]['Close'])
plt.plot(s[i]['Date'],s[i]['Close']/mc,sty[i],linewidth=3,label=i)
plt.plot(s[i]['Date'],s[i]['High']/mc,sty[i],linewidth=1)
plt.plot(s[i]['Date'],s[i]['Low']/mc,sty[i],linewidth=1)
plt.xticks(rotation=90)
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
** (:toggle hide hw2_2 button show="Solution 2 (Python)":)
(:div id=hw2_2:)
(:source lang=python:)
import pandas as pd
import matplotlib.pyplot as plt
# import data
# Time (sec), Heater 1, Heater 2, Temperature 1, Temperature 2
x = pd.read_csv('https://apmonitor.com/che263/uploads/Main/tclab.txt')
# print column headers and starting 10 rows (5 is default)
print('Data')
print(x.head(10))
# plot data
plt.figure()
plt.subplot(2,1,1)
plt.title('Temperature Control Lab')
plt.plot(x['Time (sec)'],x['Temperature 1'],'r--')
plt.plot(x['Time (sec)'],x['Temperature 2'],'b-')
plt.ylabel('Temp (degC)')
plt.legend(loc='best')
plt.subplot(2,1,2)
plt.plot(x['Time (sec)'],x['Heater 1'],'r--')
plt.plot(x['Time (sec)'],x['Heater 2'],'b-')
plt.ylabel('Heater (%)')
plt.xlabel('Time (sec)')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
** (:toggle hide hw2_3 button show="Solution 3 (Python)":)
(:div id=hw2_3:)
(:source lang=python:)
import math as m
# part a
help(m.cos)
y = m.cos(0.5)
print('cos(0.5): ' + str(y))
# part b
y = m.sin(30.0*(m.pi/180.0))
print('sin(30 deg): ' + str(y))
# part c
y = m.tan(m.pi/2.0)
print('tan(pi/x): ' + str(y))
# part d
x = 5.0
y = max(2.0*m.sqrt(x),(x**2)/2.0,\
(x**3)/3.0,(x**2+x**3)/5.0)
print('max value: ' + str(y))
# part e
x = 25
y = m.factorial(x)
print('25!: ' + str(y))
# part f
x = 0.5
# if..else statement
if x<1.0:
y = x**2
else:
y = m.sin(m.pi*x/2.0)
# same but one line
y = x**2 if x<1.0 else m.sin(m.pi*x/2.0)
print('if statement result: ' + str(y))
# part g
x = 4.999
y = m.floor(x)
print('floor(4.999): ' + str(y))
(:sourceend:)
(:divend:)
*[[Attach:hw3.pdf|Assignment #3]]
** [[Main/ExcelSolveEquations|Solve Equations]]
** Excel [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]], [[https://youtu.be/GMC31hEhFMg|Solution 3]], [[https://youtu.be/7HDO0ORwjn0|Solution 4]]
** (:toggle hide hw3_1 button show="Solution 1 (Python)":)
(:div id=hw3_1:)
(:source lang=python:)
# method #1: NumPy
from numpy.linalg import solve
A = [[11.0, 3.0, 0.0, 1.0, 2.0],\
[ 0.0, 4.0, 2.0, 0.0, 1.0],\
[ 3.0, 2.0, 7.0, 1.0, 0.0],\
[ 4.0, 0.0, 4.0, 10.0, 1.0],\
[ 2.0, 5.0, 1.0, 3.0, 14.0]]
b = [45.0, 30.0, 15.0, 20.0, 92.0]
x = solve(A,b)
print('NumPy Solution')
print(x)
# method #2: Gekko
from gekko import GEKKO
m = GEKKO()
x1,x2,x3,x4,x5 = [m.Var() for i in range(5)]
m.Equation(11*x1+3*x2+x4+2*x5==45)
m.Equation(4*x2+2*x3+x5==30)
m.Equation(3*x1+2*x2+7*x3+x4==15)
m.Equation(4*x1+4*x3+10*x4+x5==20)
m.Equation(2*x1+5*x2+x3+3*x4+14*x5==92)
m.solve(disp=False)
print('Gekko Solution')
print(x1.value)
print(x2.value)
print(x3.value)
print(x4.value)
print(x5.value)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_2 button show="Solution 2 (Python)":)
(:div id=hw3_2:)
(:source lang=python:)
# method #1: NumPy
from scipy.optimize import fsolve
def f(z):
x,y=z
f1 = 2*x**2+y**2-1
f2 = (0.5*x-0.5)**2+2.0*(y-0.25)**2-1
return [f1,f2]
x,y = fsolve(f,[1,1])
print('NumPy Solution')
print(x,y)
# method #2: Gekko
from gekko import GEKKO
m = GEKKO()
x,y = [m.Var(value=1) for i in range(2)]
m.Equation(2*x**2+y**2==1)
m.Equation((0.5*x-0.5)**2+2.0*(y-0.25)**2==1)
m.solve(disp=False)
print('Gekko Solution')
print(x.value)
print(y.value)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_3 button show="Solution 3 (Python)":)
(:div id=hw3_3:)
(:source lang=python:)
import numpy as np
from scipy.optimize import fsolve
# constants
TC = 77 # degC
P = 1.0 # bar
a = 2.877e8 # cm^6 bar K^0.5 / mol^2
b = 60.211 # cm^3 / mol
Rg = 83.144598 # cm^3 bar / K-mol
# derived quantities
TK = TC+273.15 # K
# method #1: NumPy
def f(V):
return P - Rg*TK/(V-b)+a/(np.sqrt(TK)*V*(V+b))
V_liq = fsolve(f,82) # Liquid root
V_vap = fsolve(f,28600) # Vapor root
print('NumPy Solution')
print(V_liq,V_vap)
# method #2: Gekko
from gekko import GEKKO
m = GEKKO()
V = m.Var(value=[82,28600])
m.Equation(P==Rg*TK/(V-b)-a/(m.sqrt(TK)*V*(V+b)))
m.options.IMODE=2
m.solve(disp=False)
print('Gekko Solution')
print(V.value)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_4 button show="Solution 4 (Python)":)
(:div id=hw3_4:)
(:source lang=python:)
from gekko import GEKKO
# constants
y1 = 0.33
y2 = 1.0-y1
P = 120.0 # kPa
# Antoine constants
# Benzene
ac1 = [13.7819, 2726.81, 217.572]
# Toluene
ac2 = [13.9320, 3056.96, 217.625]
# gekko model
m = GEKKO()
T = m.Var(value=100)
x1,x2 = [m.Var(value=0.5,lb=0,ub=1) for i in range(2)]
# vapor pressure
Psat1 = m.Intermediate(m.exp(ac1[0]-ac1[1]/(T+ac1[2])))
Psat2 = m.Intermediate(m.exp(ac2[0]-ac2[1]/(T+ac2[2])))
# Raoult's law
m.Equation(y1*P==x1*Psat1)
m.Equation(y2*P==x2*Psat2)
m.Equation(x1+x2==1)
m.options.IMODE=1
m.solve(disp=False)
print('Gekko Solution')
print('x1: ' + str(x1.value))
print('x2: ' + str(x2.value))
print('T: ' + str(T.value))
(:sourceend:)
(:divend:)
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Excel Template]] - [[Attach:heart_rate.txt|HR Data]] - [[Attach:dynamics.txt|Dynamics Data]]
** [[Main/ExcelDataRegression|Data Regression]]
** Excel [[https://youtu.be/X4jneorGsls|Solution 1]], [[https://youtu.be/eXco8_3MmjI|Solution 2]], [[https://youtu.be/kehsHfFMsAE|Solution 3]]
** Python [[https://youtu.be/sGZbQgDOfi4|Solution 1]]
** (:toggle hide hw4_1a button show="Solution 1 (Python curve_fit)":)
(:div id=hw4_1a:)
(:source lang=python:)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
# import data
# Time (sec),Heart Rate (BPM)
url = 'https://apmonitor.com/che263/uploads/Main/heart_rate.txt'
x = pd.read_csv(url)
# print first rows
print('Data')
print(x.head())
# extract vectors
t = x['Time (sec)'].values
ym = x['Heart Rate (BPM)'].values
# define function for fitting
def bpm(t,c0,c1,c2,c3):
return c0+c1*t-c2*np.exp(-c3*t)
# find optimal parameters
p0 = [100,0.01,100,0.01] # initial guesses
c,cov = curve_fit(bpm,t,ym,p0) # fit model
# print parameters
print('Optimal parameters')
print(c)
# calculate prediction
yp = bpm(t,c[0],c[1],c[2],c[3])
# calculate r^2
print('R^2: ' + str(r2_score(ym,yp)))
# plot data and prediction
plt.figure()
plt.title('Heart Rate Regression')
plt.plot(t/60.0,ym,'r--',label='Measured')
plt.plot(t/60.0,yp,'b-',label='Predicted')
plt.ylabel('Rate (BPM)')
plt.xlabel('Time (min)')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
** (:toggle hide hw4_1b button show="Solution 1 (Python GEKKO)":)
(:div id=hw4_1b:)
(:source lang=python:)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from gekko import GEKKO
from sklearn.metrics import r2_score
# import data
# Time (sec),Heart Rate (BPM)
url = 'https://apmonitor.com/che263/uploads/Main/heart_rate.txt'
x = pd.read_csv(url)
# print first rows
print('Data')
print(x.head())
# extract vectors
t = np.array(x['Time (sec)'])
ym = np.array(x['Heart Rate (BPM)'])
# GEKKO model
m = GEKKO()
# parameters
tm = m.Param(value=t)
c0 = m.FV(value=100)
c1 = m.FV(value=0.01)
c2 = m.FV(value=100)
c3 = m.FV(value=0.01)
c0.STATUS=1
c1.STATUS=1
c2.STATUS=1
c3.STATUS=1
# variables
bpm = m.CV(value=ym)
bpm.FSTATUS=1
# regression equation
m.Equation(bpm==c0+c1*tm-c2*m.exp(-c3*tm))
# regression mode
m.options.IMODE = 2
# optimize
m.solve()
# print parameters
print('Optimal parameters')
print(c0.value[0])
print(c1.value[0])
print(c2.value[0])
print(c3.value[0])
# calculate r^2
print('R^2: ' + str(r2_score(ym,bpm)))
# plot data and prediction
plt.figure()
plt.title('Heart Rate Regression')
plt.plot(t/60.0,ym,'r--',label='Measured')
plt.plot(t/60.0,bpm,'b-',label='Predicted')
plt.ylabel('Rate (BPM)')
plt.xlabel('Time (min)')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
** (:toggle hide hw4_2 button show="Solution 2 (Python)":)
(:div id=hw4_2:)
(:source lang=python:)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
# import data
# time (min),y
url = 'https://apmonitor.com/che263/uploads/Main/dynamics.txt'
x = pd.read_csv(url)
# print first rows
print('Data')
print(x.head())
# extract vectors
t = x['time (min)'].values
ym = x['y'].values
# define function for fitting
def yfcn(t,tau,theta):
n = len(t)
res = np.zeros(n)
for i in range(n):
if i>=theta:
res[i] = 5.0*(1.0-np.exp(-(t[i]-theta)/tau))
return res
# find optimal parameters
c,cov = curve_fit(yfcn,t,ym)
# print parameters
print('Optimal parameters')
tau = c[0]
theta = c[1]
print(c)
# calculate prediction
yp = yfcn(t,tau,theta)
# calculate r^2
print('R^2: ', r2_score(yp,ym))
# plot data and prediciton
plt.figure()
plt.title('Step Test Regression')
plt.plot(t,ym,'ro',label='Measured')
plt.plot(t,yp,'b-',label='Predicted')
plt.ylabel('Response')
plt.xlabel('Time (min)')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
** (:toggle hide hw4_3 button show="Solution 3 (Python)":)
(:div id=hw4_3:)
(:source lang=python:)
import numpy as np
import matplotlib.pyplot as plt
# generate 1000 random numbers
# with Poisson distribution and lambda=1
n = 1000
lam = 1
x = np.random.poisson(lam,n)
# count number in each bin
bins=[0,1,2,3,4,5,6]
hist, _ = np.histogram(x, bins)
# plot histogram data
plt.bar(bins[0:-1],hist,label='1000 samples')
plt.xlabel('bin')
plt.ylabel('count')
plt.title('Poisson Distribution (lambda=1)')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
*[[Attach:hw5.pdf|Assignment #5]]
** [[Main/ExcelEulers|Differential Equation Solution]]
** Excel [[https://youtu.be/cc8CuFTX5CI|Solution 1]], [[https://youtu.be/ySrMlC-bnGM|Solution 2]]
** (:toggle hide hw5_1ab button show="Solution 1ab (Python)":)
(:div id=hw5_1ab:)
(:source lang=python:)
import numpy as np
import matplotlib.pyplot as plt
from gekko import GEKKO
from scipy.integrate import odeint
# number of time points
n = 15
# final time
tf = 7.0
# initial concentration
Ca0 = 5.0
# constants
k = 1 # 1/s
# method #1 Analytical solution
# Ca(t) = Ca(0) * exp(-k*t)
t = np.linspace(0,tf,n)
Ca_m1 = Ca0 * np.exp(-k*t)
# method #2 Euler's method
Ca_m2 = np.empty(n)
Ca_m2[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t[i] - t[i-1]
Ca_m2[i] = Ca_m2[i-1] - k * Ca_m2[i-1] * dt
# method #3: GEKKO solution
# create new gekko model
m = GEKKO()
# integration time points
m.time = t
# variables
Ca = m.Var(value=Ca0)
# differential equation
m.Equation(Ca.dt()==-k*Ca)
# set options
m.options.IMODE = 4 # dynamic simulation
m.options.NODES = 3 # collocation nodes
# simulate ODE
m.solve()
# method #4: ODEINT from SciPy
def dCadt(t,Ca):
return -k * Ca
Ca_m4 = odeint(dCadt,t,Ca0)
# plot results
plt.figure(1)
plt.plot(t,Ca_m1,'r-',label='Ca (Analytical)')
plt.plot(t,Ca_m2,'ko',label='Ca (Euler)')
plt.plot(t,Ca,'b--',label='Ca (GEKKO)')
plt.plot(t,Ca,'ys',label='Ca (ODEINT)')
plt.xlabel('Time (sec)')
plt.ylabel(r'$C_a (kmol/m^3)$')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
** (:toggle hide hw5_1c button show="Solution 1c (Python)":)
(:div id=hw5_1c:)
(:source lang=python:)
import numpy as np
import matplotlib.pyplot as plt
from gekko import GEKKO
from scipy.integrate import odeint
# number of time points
n = 15
# final time
tf = 7.0
# initial concentration
Ca0 = 5.0
# constants
k = 1 # 1/s
# method #1 Analytical solution
# Ca(t) = Ca(0) * exp(-k*t)
t = np.linspace(0,tf,n)
Ca_m1 = Ca0 * np.exp(-k*t)
# method #2 Euler's method
t2 = np.arange(0,tf,0.5)
n = len(t2)
Ca_m2 = np.empty_like(t2)
Ca_m2[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t2[i] - t2[i-1]
Ca_m2[i] = Ca_m2[i-1] - k * Ca_m2[i-1] * dt
t3 = np.arange(0,tf,1.5)
n = len(t3)
Ca_m3 = np.empty_like(t3)
Ca_m3[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t3[i] - t3[i-1]
Ca_m3[i] = Ca_m3[i-1] - k * Ca_m3[i-1] * dt
t4 = np.arange(0,tf,2.1)
n = len(t4)
Ca_m4 = np.empty_like(t4)
Ca_m4[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t4[i] - t4[i-1]
Ca_m4[i] = Ca_m4[i-1] - k * Ca_m4[i-1] * dt
# plot results
plt.figure(1)
plt.plot(t,Ca_m1,'r-',label='Ca (Analytical)')
plt.plot(t2,Ca_m2,'k.-',label='Ca (Euler 0.5)')
plt.plot(t3,Ca_m3,'bo-',label='Ca (Euler 1.5)')
plt.plot(t4,Ca_m4,'y--',label='Ca (Euler 2.1)')
plt.xlabel('Time (sec)')
plt.ylabel(r'$C_a (kmol/m^3)$')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
** (:toggle hide hw5_2 button show="Solution 2 (Python)":)
(:div id=hw5_2:)
(:source lang=python:)
import numpy as np
import matplotlib.pyplot as plt
from gekko import GEKKO
# final time
tf = 3.0
# constants
k1 = 1.0 # L/mol-s
k2 = 1.5 # L/mol-s
# GEKKO solution
# create new gekko model
m = GEKKO()
# integration time points
m.time = np.arange(0,tf+0.01,0.2)
# variables
Ca = m.Var(value=1.0)
Cb = m.Var(value=1.0)
Cc = m.Var(value=0.0)
Cd = m.Var(value=0.0)
S = m.Var(value=1.0)
# differential equations
m.Equation(Ca.dt()==-k1*Ca*Cb)
m.Equation(Cb.dt()==-k1*Ca*Cb-k2*Cb*Cc)
m.Equation(Cc.dt()== k1*Ca*Cb-k2*Cb*Cc)
m.Equation(Cd.dt()== k2*Cb*Cc)
m.Equation(S==Cc/(Cc+Cd))
# set options
m.options.IMODE = 4 # dynamic simulation
m.options.NODES = 3 # collocation nodes
# simulate ODE
m.solve()
# plot results
plt.figure(1)
plt.subplot(2,1,1)
plt.plot(m.time,Ca,'r-',label='Ca',linewidth=2.0)
plt.plot(m.time,Cb,'k.-',label='Cb',linewidth=2.0)
plt.plot(m.time,Cc,'b--',label='Cc',linewidth=2.0)
plt.plot(m.time,Cd,'y:',label='Cd',linewidth=3.0)
plt.ylabel('Conc (mol/L)')
plt.legend(loc='best')
plt.subplot(2,1,2)
plt.plot(m.time,S,'k-',label='Selectivity',linewidth=2.0)
plt.xlabel('Time (sec)')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
*[[Attach:hw6.pdf|Assignment #6]]
** [[Main/VbaMacro|VBA Macros]]
** Excel [[https://youtu.be/bHwFTDp5g6A|Solution 1]], [[https://youtu.be/0C6QMin5OZc|Solution 2]]
** (:toggle hide hw6_2 button show="Solution 2 (Python)":)
(:div id=hw6_2:)
(:source lang=python:)
import numpy as np
r = 5 # m
h = 10 # m
F = 15 # m^3/min
t = 180 # min
V_tank = np.pi * r**2 * h # m^3
V_crude_oil = F * t # m^3
if V_crude_oil > V_tank:
print('Tank Overfilled by ' \
+ str(V_crude_oil-V_tank) + ' m^3')
else:
print('Not Overfilled')
(:sourceend:)
(:divend:)
!!!!Python Assignments
*[[Attach:hw7.pdf|Assignment #7]] - [[Attach:hw7.zip|Files]]
** [[Main/PythonConditionals|Conditionals]]
** [[Main/PythonFunctions|Functions]]
** Solution [[https://youtu.be/r7C2Hu1Qtgg|1]], [[https://youtu.be/YugOojaknDM|2]], [[https://youtu.be/L7scElJU36s|3]], [[https://youtu.be/p2Dyx9DyQWw|4]]
*[[Attach:hw8.pdf|Assignment #8]] - [[Attach:hw8.zip|Files]]
** [[Main/PythonLoops|Loops]]
** [[Main/PythonArrays|Arrays]]
** [[https://youtu.be/2Y6aMjBYPww|Solutions]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]]
** [[Main/PythonPlots|Generate Plots]]
** Solution [[https://youtu.be/ziRNzO1T-Mo|1]], [[https://youtu.be/Ql8QPcp8818|2]], [[https://youtu.be/6r5JZjokp-0|3]], [[https://youtu.be/G0ceVjin_cg|4]]
*[[Attach:hw10.pdf|Assignment #10]]
** [[https://apmonitor.com/heat.htm|Temperature Control Lab]]
** [[https://youtu.be/vY9Sv605E8c|Solution 1]], [[https://youtu.be/ygoohjN_Lww|Solution 2]]
*[[Attach:hw11.pdf|Assignment #11]] - [[Attach:hw11.zip|Files]]
** [[Main/PythonDebug|Debugging]]
** [[ https://youtu.be/ezuRn1ViIJE|Solutions 1-5]], [[https://youtu.be/8SNaW1nt6j0|Solution 6]]
*[[Attach:hw12.pdf|Assignment #12]] - [[Attach:hw12.zip|Files]]
** [[Main/PythonDataAnalysis|File Input and Output]]
** [[https://youtu.be/oCr2eUIYznc|Solutions 1-2]], [[https://youtu.be/vjCctma5dYg|Solution 3]]
*[[Attach:hw13.pdf|Assignment #13]] - [[Attach:hw13.zip|Files]]
** [[https://youtu.be/LwOg0b0ZwCM|Classes (collections of values and functions)]]
** [[https://youtu.be/ntyGGOiOD9w|Solutions 1]] - [[https://youtu.be/mV9HECu07z8|Solutions 2]]
*[[Attach:hw14.pdf|Assignment #14]] - [[Attach:hw14.zip|Files]]
** [[Main/PythonSolveEquations|Solve Equations]]
** [[ https://youtu.be/v4R6K4RxADE|Solutions 1-2]], [[https://youtu.be/66hOMWZec10|Solution 3]], [[https://youtu.be/Y7YBPqGKr9Y|Solution 4]]
*[[Attach:hw15.pdf|Assignment #15]] - [[Attach:hw15.zip|Files]]
** [[Main/PythonDataRegression|Data Regression]]
** [[https://youtu.be/4grhQ5Y_MWo|Solution 1]], [[https://youtu.be/Lj_-7xIGkeI|Solutions 2-4]]
*[[Attach:hw16.pdf|Assignment #16]] - [[Attach:hw16.zip|Files]]
** [[Main/PythonDynamicSim|Solve Differential Equations]]
** [[https://youtu.be/BRe7qKIAa34|Solution]]
*[[Attach:hw17.pdf|Assignment #17]] - [[Attach:hw17.zip|Files]]
** [[https://youtu.be/SFI_l96Oss4|Symbolic Derivatives]] and [[https://youtu.be/4grhQ5Y_MWo|Integrals]]
** [[https://youtu.be/EaYEQ30KlWw|Solution]]
!!!!MathCAD Assignments
*[[Attach:hw_mathcad_basics.pdf|Assignment #18 - Variables and Equations (MathCAD)]] and [[Attach:hw_python_basics.zip|(Python)]]
** [[https://youtu.be/UV7aU7HXv7E | Solutions (MathCAD)]]
** [[https://youtu.be/QlRB2k9i4gc | Solutions 1-7]] and [[https://youtu.be/6gjYvgIpDo8 | 8-10 (Python)]]
*[[Attach:hw_mathcad_arrays_functions.pdf|Assignment #19 - Functions, Arrays, and Logical Conditions]]
** [[Attach:hw9_array.zip|Download array.txt for import]]
** [[https://youtu.be/Gpzv0GfZ0LM|Solutions]]
*[[Attach:hw_mathcad_symbolics_plotting_solve.pdf|Assignment #20 - Symbolic Manipulation, Plots, and Solve Blocks]]
** [[https://youtu.be/XOxK4aKvLk0 | Solutions 1-6]]
** [[https://youtu.be/O4_lYRMawXo | Solutions 7-9]]
*[[Attach:hw_mathcad_curvefit_solve.pdf|Assignment #21 - Curve Fitting, Advanced Plots, and More on Solve Blocks]]
** [[Attach:hw11_supplemental_file.zip|Assignment #21 - Supplemental Files]]
Added line 133:
Changed lines 141-171 from:
Excel [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
Python [[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW01.ipynb|CL1]]
** (:toggle hide hw1_2 button show="Solution 2 (Python)":)
(:div id=hw1_2:)
(:source lang=python:)
# constants
L = 2 # m
Tplate = 343 # K
v = 1.45 # m/s
Twater = 294 # K
mu = 9.79e-4 # Pa*s
rho = 998 # kg/m^3
k = 0.601 # W/m-K
cp = 4.18e3 # J/kg-K
# derived quantities
Re = rho*L*v/mu
Pr = mu*cp/k
Nu = 0.332 * Pr**(1.0/3.0) * Re**(1.0/2.0)
h = Nu * k / L
q = h * (Tplate-Twater)
print('Rate of Heat Transfer')
print(str(q)+' W/m^2')
(:sourceend:)
(:divend:)
to:
[[https://youtu.be/VPjoNrtm8wk|Excel Solution 2]]
[[https://youtu.be/JF7Lda8_YzE|Excel Solution 3]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW01.ipynb|Python Solutions]]
[[https://youtu.be/JF7Lda8_YzE|Excel Solution 3]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW01.ipynb|Python Solutions]]
Added lines 149-151:
[[Attach:hw2.pdf|Assignment #2]]
[[Attach:tclab.txt|Problem 2 Data File]]
[[Attach:tclab.txt|Problem 2 Data File]]
Added lines 153-155:
[[Main/ExcelScatterPlots|Generate Plots]]
[[Main/ExcelDataAnalysis|Data Analysis]]
[[Main/ExcelDataAnalysis|Data Analysis]]
Changed lines 157-165 from:
to:
[[https://youtu.be/CchyR-vmFbk|Excel Solution 1]]
[[https://youtu.be/6vFynd2bGoQ|Excel Solution 2]]
[[https://youtu.be/AJwxW6oMu_E|Excel Solution 3]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW02.ipynb|Python Solutions]]
[[https://youtu.be/6vFynd2bGoQ|Excel Solution 2]]
[[https://youtu.be/AJwxW6oMu_E|Excel Solution 3]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW02.ipynb|Python Solutions]]
Added line 167:
[[Attach:hw3.pdf|Assignment #3]]
Added line 169:
[[Main/ExcelSolveEquations|Solve Equations]]
Changed lines 171-291 from:
to:
[[https://youtu.be/wbDfPIpTf4E|Excel Solution 1]]
[[https://youtu.be/td9AQZF5gIM|Excel Solution 2]]
[[https://youtu.be/GMC31hEhFMg|Excel Solution 3]]
[[https://youtu.be/7HDO0ORwjn0|Excel Solution 4]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW03.ipynb|Python Solutions]]
(:cellnr:)
[[Attach:hw4.pdf|Assignment #4]]
[[Attach:hw4.zip|Excel Template]]
[[Attach:heart_rate.txt|HR Data]]
[[Attach:dynamics.txt|Dynamic Data]]
(:cell:)
[[Main/ExcelDataRegression|Data Regression]]
(:cell:)
[[https://youtu.be/X4jneorGsls|Excel Solution 1]]
[[https://youtu.be/eXco8_3MmjI|Excel Solution 2]]
[[https://youtu.be/kehsHfFMsAE|Excel Solution 3]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW03.ipynb|Python Solutions]]
(:cellnr:)
[[Attach:hw5.pdf|Assignment #5]]
(:cell:)
[[Main/ExcelEulers|Differential Equation Solution]]
(:cell:)
[[https://youtu.be/cc8CuFTX5CI|Excel Solution 1]]
[[https://youtu.be/ySrMlC-bnGM|Excel Solution 2]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW04.ipynb|Python Solutions]]
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
[[https://youtu.be/td9AQZF5gIM|Excel Solution 2]]
[[https://youtu.be/GMC31hEhFMg|Excel Solution 3]]
[[https://youtu.be/7HDO0ORwjn0|Excel Solution 4]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW03.ipynb|Python Solutions]]
(:cellnr:)
[[Attach:hw4.pdf|Assignment #4]]
[[Attach:hw4.zip|Excel Template]]
[[Attach:heart_rate.txt|HR Data]]
[[Attach:dynamics.txt|Dynamic Data]]
(:cell:)
[[Main/ExcelDataRegression|Data Regression]]
(:cell:)
[[https://youtu.be/X4jneorGsls|Excel Solution 1]]
[[https://youtu.be/eXco8_3MmjI|Excel Solution 2]]
[[https://youtu.be/kehsHfFMsAE|Excel Solution 3]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW03.ipynb|Python Solutions]]
(:cellnr:)
[[Attach:hw5.pdf|Assignment #5]]
(:cell:)
[[Main/ExcelEulers|Differential Equation Solution]]
(:cell:)
[[https://youtu.be/cc8CuFTX5CI|Excel Solution 1]]
[[https://youtu.be/ySrMlC-bnGM|Excel Solution 2]]
[[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW04.ipynb|Python Solutions]]
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
Added lines 293-295:
Added lines 145-169:
** (:toggle hide hw1_2 button show="Solution 2 (Python)":)
(:div id=hw1_2:)
(:source lang=python:)
# constants
L = 2 # m
Tplate = 343 # K
v = 1.45 # m/s
Twater = 294 # K
mu = 9.79e-4 # Pa*s
rho = 998 # kg/m^3
k = 0.601 # W/m-K
cp = 4.18e3 # J/kg-K
# derived quantities
Re = rho*L*v/mu
Pr = mu*cp/k
Nu = 0.332 * Pr**(1.0/3.0) * Re**(1.0/2.0)
h = Nu * k / L
q = h * (Tplate-Twater)
print('Rate of Heat Transfer')
print(str(q)+' W/m^2')
(:sourceend:)
(:divend:)
Changed lines 136-137 from:
to:
[[Main/ExcelConditionals|Conditionals]]
[[Main/ExcelFunctions|Functions]]
[[Main/ExcelFunctions|Functions]]
Changed lines 140-142 from:
to:
Excel [[https://youtu.be/VPjoNrtm8wk|Solution 2]]
Excel [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
Python [[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW01.ipynb|CL1]]
Excel [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
Python [[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW01.ipynb|CL1]]
Added lines 5-119:
(:html:)
<style type="text/css">
div.table-title {
display: block;
margin: auto;
max-width: 600px;
padding:5px;
width: 100%;
}
.table-title h3 {
color: #fafafa;
}
.table-fill {
background: white;
border-radius:3px;
border-collapse: collapse;
height: 320px;
margin: auto;
max-width: 600px;
padding:5px;
width: 100%;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
animation: float 5s infinite;
}
th {
color:#D5DDE5;;
background:#1b1e24;
border-bottom:4px solid #9ea7af;
border-right: 1px solid #343a45;
text-align:left;
vertical-align:middle;
}
th:first-child {
border-top-left-radius:3px;
}
th:last-child {
border-top-right-radius:3px;
border-right:none;
}
tr {
border-top: 1px solid #C1C3D1;
border-bottom-: 1px solid #C1C3D1;
color:#666B85;
font-weight:normal;
}
tr:hover td {
border-top: 1px solid #22262e;
border-bottom: 1px solid #22262e;
}
tr:first-child {
border-top:none;
}
tr:last-child {
border-bottom:none;
}
tr:nth-child(odd) td {
background:#EEEEEE;
}
tr:last-child td:first-child {
border-bottom-left-radius:3px;
}
tr:last-child td:last-child {
border-bottom-right-radius:3px;
}
td {
background:#FFFFFF;
padding:5px;
text-align:left;
vertical-align:middle;
border-right: 1px solid #C1C3D1;
}
td:last-child {
border-right: 0px;
}
th.text-left {
text-align: left;
}
th.text-center {
text-align: center;
}
th.text-right {
text-align: right;
}
td.text-left {
text-align: left;
}
td.text-center {
text-align: center;
}
td.text-right {
text-align: right;
}
</style>
(:htmlend:)
<style type="text/css">
div.table-title {
display: block;
margin: auto;
max-width: 600px;
padding:5px;
width: 100%;
}
.table-title h3 {
color: #fafafa;
}
.table-fill {
background: white;
border-radius:3px;
border-collapse: collapse;
height: 320px;
margin: auto;
max-width: 600px;
padding:5px;
width: 100%;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
animation: float 5s infinite;
}
th {
color:#D5DDE5;;
background:#1b1e24;
border-bottom:4px solid #9ea7af;
border-right: 1px solid #343a45;
text-align:left;
vertical-align:middle;
}
th:first-child {
border-top-left-radius:3px;
}
th:last-child {
border-top-right-radius:3px;
border-right:none;
}
tr {
border-top: 1px solid #C1C3D1;
border-bottom-: 1px solid #C1C3D1;
color:#666B85;
font-weight:normal;
}
tr:hover td {
border-top: 1px solid #22262e;
border-bottom: 1px solid #22262e;
}
tr:first-child {
border-top:none;
}
tr:last-child {
border-bottom:none;
}
tr:nth-child(odd) td {
background:#EEEEEE;
}
tr:last-child td:first-child {
border-bottom-left-radius:3px;
}
tr:last-child td:last-child {
border-bottom-right-radius:3px;
}
td {
background:#FFFFFF;
padding:5px;
text-align:left;
vertical-align:middle;
border-right: 1px solid #C1C3D1;
}
td:last-child {
border-right: 0px;
}
th.text-left {
text-align: left;
}
th.text-center {
text-align: center;
}
th.text-right {
text-align: right;
}
td.text-left {
text-align: left;
}
td.text-center {
text-align: center;
}
td.text-right {
text-align: right;
}
</style>
(:htmlend:)
Added lines 123-154:
(:table border=0 frame=hsides width=95%:)
(:cell width=25%:)
'''Assignment'''
(:cell width=35%:)
'''Knowledge Building'''
(:cell width=30%:)
'''Solutions'''
(:cellnr:)
[[Attach:hw1.pdf|Assignment #1]]
(:cell:)
* [[Main/ExcelConditionals|Conditionals]]
* [[Main/ExcelFunctions|Functions]]
(:cell:)
* Excel [[https://youtu.be/VPjoNrtm8wk|Solution 2]]
* Excel [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
* Python [[https://colab.research.google.com/github/APMonitor/learn_python/blob/master/HW01.ipynb|CL1]]
(:cellnr:)
(:cell:)
(:cell:)
(:cellnr:)
(:cell:)
(:cell:)
(:tableend:)
Changed line 297 from:
** (:toggle hide hw3_4 button show="Solution 3 (Python)":)
to:
** (:toggle hide hw3_4 button show="Solution 4 (Python)":)
Changed lines 765-766 from:
** [[ https://youtu.be/ezuRn1ViIJE|Solutions (1-5)]], [[https://youtu.be/8SNaW1nt6j0|Solution 6]]
to:
** [[ https://youtu.be/ezuRn1ViIJE|Solutions 1-5]], [[https://youtu.be/8SNaW1nt6j0|Solution 6]]
Changed line 769 from:
** [[https://youtu.be/oCr2eUIYznc|Solutions]]
to:
** [[https://youtu.be/oCr2eUIYznc|Solutions 1-2]], [[https://youtu.be/vjCctma5dYg|Solution 3]]
Changed line 761 from:
** [[https://youtu.be/ygoohjN_Lww|Solution 2]]
to:
** [[https://youtu.be/vY9Sv605E8c|Solution 1]], [[https://youtu.be/ygoohjN_Lww|Solution 2]]
Changed lines 760-761 from:
** [[Main/PythonWidgets|User Interaction]]
** [[https://youtu.be/ouyg_TQGI2Q|Solution 2 (Video)]] - [[Attach:hw10.zip|Solution 2 (.py)]] - [[https://youtu.be/ygoohjN_Lww|Solution 3]]
** [[https://youtu.be/
to:
** [[https://apmonitor.com/heat.htm|Temperature Control Lab]]
** [[https://youtu.be/ygoohjN_Lww|Solution 2]]
** [[https://youtu.be/ygoohjN_Lww|Solution 2]]
Added line 336:
** Python [[https://youtu.be/sGZbQgDOfi4|Solution 1]]
Changed line 376 from:
# plot data and prediciton
to:
# plot data and prediction
Changed line 446 from:
# plot data and prediciton
to:
# plot data and prediction
Changed line 7 from:
Complete the following assignments with Microsoft Excel, Google Sheets, or another similar spreadsheet program. Microsoft Excel solutions are shown for each problem but should only be used as a learning resource, not to merely complete the assignment. Python solutions are shown as a reference and introduction to programming but are not required.
to:
Complete the following assignments with Microsoft Excel, Google Sheets, or another similar spreadsheet program. Microsoft Excel solutions are shown for each problem but should only be used as a learning resource, not to merely complete the assignment. Python solutions are shown as examples of programming but are not required.
Deleted lines 720-725:
(:div id=hw6_1:)
(:source lang=python:)
(:sourceend:)
(:divend:)
Changed lines 300-329 from:
to:
from gekko import GEKKO
# constants
y1 = 0.33
y2 = 1.0-y1
P = 120.0 # kPa
# Antoine constants
# Benzene
ac1 = [13.7819, 2726.81, 217.572]
# Toluene
ac2 = [13.9320, 3056.96, 217.625]
# gekko model
m = GEKKO()
T = m.Var(value=100)
x1,x2 = [m.Var(value=0.5,lb=0,ub=1) for i in range(2)]
# vapor pressure
Psat1 = m.Intermediate(m.exp(ac1[0]-ac1[1]/(T+ac1[2])))
Psat2 = m.Intermediate(m.exp(ac2[0]-ac2[1]/(T+ac2[2])))
# Raoult's law
m.Equation(y1*P==x1*Psat1)
m.Equation(y2*P==x2*Psat2)
m.Equation(x1+x2==1)
m.options.IMODE=1
m.solve(disp=False)
print('Gekko Solution')
print('x1: ' + str(x1.value))
print('x2: ' + str(x2.value))
print('T: ' + str(T.value))
# constants
y1 = 0.33
y2 = 1.0-y1
P = 120.0 # kPa
# Antoine constants
# Benzene
ac1 = [13.7819, 2726.81, 217.572]
# Toluene
ac2 = [13.9320, 3056.96, 217.625]
# gekko model
m = GEKKO()
T = m.Var(value=100)
x1,x2 = [m.Var(value=0.5,lb=0,ub=1) for i in range(2)]
# vapor pressure
Psat1 = m.Intermediate(m.exp(ac1[0]-ac1[1]/(T+ac1[2])))
Psat2 = m.Intermediate(m.exp(ac2[0]-ac2[1]/(T+ac2[2])))
# Raoult's law
m.Equation(y1*P==x1*Psat1)
m.Equation(y2*P==x2*Psat2)
m.Equation(x1+x2==1)
m.options.IMODE=1
m.solve(disp=False)
print('Gekko Solution')
print('x1: ' + str(x1.value))
print('x2: ' + str(x2.value))
print('T: ' + str(T.value))
Changed lines 336-337 from:
** (:toggle hide hw4_1 button show="Solution 1 (Python)":)
(:div id=hw4_1:)
(:div id=hw4_
to:
** (:toggle hide hw4_1a button show="Solution 1 (Python curve_fit)":)
(:div id=hw4_1a:)
(:div id=hw4_1a:)
Changed lines 339-384 from:
to:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
# import data
# Time (sec),Heart Rate (BPM)
url = 'https://apmonitor.com/che263/uploads/Main/heart_rate.txt'
x = pd.read_csv(url)
# print first rows
print('Data')
print(x.head())
# extract vectors
t = x['Time (sec)'].values
ym = x['Heart Rate (BPM)'].values
# define function for fitting
def bpm(t,c0,c1,c2,c3):
return c0+c1*t-c2*np.exp(-c3*t)
# find optimal parameters
p0 = [100,0.01,100,0.01] # initial guesses
c,cov = curve_fit(bpm,t,ym,p0) # fit model
# print parameters
print('Optimal parameters')
print(c)
# calculate prediction
yp = bpm(t,c[0],c[1],c[2],c[3])
# calculate r^2
print('R^2: ' + str(r2_score(ym,yp)))
# plot data and prediciton
plt.figure()
plt.title('Heart Rate Regression')
plt.plot(t/60.0,ym,'r--',label='Measured')
plt.plot(t/60.0,yp,'b-',label='Predicted')
plt.ylabel('Rate (BPM)')
plt.xlabel('Time (min)')
plt.legend(loc='best')
plt.show()
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
# import data
# Time (sec),Heart Rate (BPM)
url = 'https://apmonitor.com/che263/uploads/Main/heart_rate.txt'
x = pd.read_csv(url)
# print first rows
print('Data')
print(x.head())
# extract vectors
t = x['Time (sec)'].values
ym = x['Heart Rate (BPM)'].values
# define function for fitting
def bpm(t,c0,c1,c2,c3):
return c0+c1*t-c2*np.exp(-c3*t)
# find optimal parameters
p0 = [100,0.01,100,0.01] # initial guesses
c,cov = curve_fit(bpm,t,ym,p0) # fit model
# print parameters
print('Optimal parameters')
print(c)
# calculate prediction
yp = bpm(t,c[0],c[1],c[2],c[3])
# calculate r^2
print('R^2: ' + str(r2_score(ym,yp)))
# plot data and prediciton
plt.figure()
plt.title('Heart Rate Regression')
plt.plot(t/60.0,ym,'r--',label='Measured')
plt.plot(t/60.0,yp,'b-',label='Predicted')
plt.ylabel('Rate (BPM)')
plt.xlabel('Time (min)')
plt.legend(loc='best')
plt.show()
Changed lines 387-388 from:
** (:toggle hide hw4_2 button show="Solution 2 (Python)":)
(:div id=hw4_2:)
(:div id=hw4_
to:
** (:toggle hide hw4_1b button show="Solution 1 (Python GEKKO)":)
(:div id=hw4_1b:)
(:div id=hw4_1b:)
Changed lines 390-454 from:
to:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from gekko import GEKKO
from sklearn.metrics import r2_score
# import data
# Time (sec),Heart Rate (BPM)
url = 'https://apmonitor.com/che263/uploads/Main/heart_rate.txt'
x = pd.read_csv(url)
# print first rows
print('Data')
print(x.head())
# extract vectors
t = np.array(x['Time (sec)'])
ym = np.array(x['Heart Rate (BPM)'])
# GEKKO model
m = GEKKO()
# parameters
tm = m.Param(value=t)
c0 = m.FV(value=100)
c1 = m.FV(value=0.01)
c2 = m.FV(value=100)
c3 = m.FV(value=0.01)
c0.STATUS=1
c1.STATUS=1
c2.STATUS=1
c3.STATUS=1
# variables
bpm = m.CV(value=ym)
bpm.FSTATUS=1
# regression equation
m.Equation(bpm==c0+c1*tm-c2*m.exp(-c3*tm))
# regression mode
m.options.IMODE = 2
# optimize
m.solve()
# print parameters
print('Optimal parameters')
print(c0.value[0])
print(c1.value[0])
print(c2.value[0])
print(c3.value[0])
# calculate r^2
print('R^2: ' + str(r2_score(ym,bpm)))
# plot data and prediciton
plt.figure()
plt.title('Heart Rate Regression')
plt.plot(t/60.0,ym,'r--',label='Measured')
plt.plot(t/60.0,bpm,'b-',label='Predicted')
plt.ylabel('Rate (BPM)')
plt.xlabel('Time (min)')
plt.legend(loc='best')
plt.show()
import pandas as pd
import matplotlib.pyplot as plt
from gekko import GEKKO
from sklearn.metrics import r2_score
# import data
# Time (sec),Heart Rate (BPM)
url = 'https://apmonitor.com/che263/uploads/Main/heart_rate.txt'
x = pd.read_csv(url)
# print first rows
print('Data')
print(x.head())
# extract vectors
t = np.array(x['Time (sec)'])
ym = np.array(x['Heart Rate (BPM)'])
# GEKKO model
m = GEKKO()
# parameters
tm = m.Param(value=t)
c0 = m.FV(value=100)
c1 = m.FV(value=0.01)
c2 = m.FV(value=100)
c3 = m.FV(value=0.01)
c0.STATUS=1
c1.STATUS=1
c2.STATUS=1
c3.STATUS=1
# variables
bpm = m.CV(value=ym)
bpm.FSTATUS=1
# regression equation
m.Equation(bpm==c0+c1*tm-c2*m.exp(-c3*tm))
# regression mode
m.options.IMODE = 2
# optimize
m.solve()
# print parameters
print('Optimal parameters')
print(c0.value[0])
print(c1.value[0])
print(c2.value[0])
print(c3.value[0])
# calculate r^2
print('R^2: ' + str(r2_score(ym,bpm)))
# plot data and prediciton
plt.figure()
plt.title('Heart Rate Regression')
plt.plot(t/60.0,ym,'r--',label='Measured')
plt.plot(t/60.0,bpm,'b-',label='Predicted')
plt.ylabel('Rate (BPM)')
plt.xlabel('Time (min)')
plt.legend(loc='best')
plt.show()
Changed lines 457-458 from:
** (:toggle hide hw4_3 button show="Solution 3 (Python)":)
(:div id=hw4_3:)
(:div id=hw4_
to:
** (:toggle hide hw4_2 button show="Solution 2 (Python)":)
(:div id=hw4_2:)
(:div id=hw4_2:)
Changed lines 460-511 from:
to:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
# import data
# time (min),y
url = 'https://apmonitor.com/che263/uploads/Main/dynamics.txt'
x = pd.read_csv(url)
# print first rows
print('Data')
print(x.head())
# extract vectors
t = x['time (min)'].values
ym = x['y'].values
# define function for fitting
def yfcn(t,tau,theta):
n = len(t)
res = np.zeros(n)
for i in range(n):
if i>=theta:
res[i] = 5.0*(1.0-np.exp(-(t[i]-theta)/tau))
return res
# find optimal parameters
c,cov = curve_fit(yfcn,t,ym)
# print parameters
print('Optimal parameters')
tau = c[0]
theta = c[1]
print(c)
# calculate prediction
yp = yfcn(t,tau,theta)
# calculate r^2
print('R^2: ', r2_score(yp,ym))
# plot data and prediciton
plt.figure()
plt.title('Step Test Regression')
plt.plot(t,ym,'ro',label='Measured')
plt.plot(t,yp,'b-',label='Predicted')
plt.ylabel('Response')
plt.xlabel('Time (min)')
plt.legend(loc='best')
plt.show()
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
# import data
# time (min),y
url = 'https://apmonitor.com/che263/uploads/Main/dynamics.txt'
x = pd.read_csv(url)
# print first rows
print('Data')
print(x.head())
# extract vectors
t = x['time (min)'].values
ym = x['y'].values
# define function for fitting
def yfcn(t,tau,theta):
n = len(t)
res = np.zeros(n)
for i in range(n):
if i>=theta:
res[i] = 5.0*(1.0-np.exp(-(t[i]-theta)/tau))
return res
# find optimal parameters
c,cov = curve_fit(yfcn,t,ym)
# print parameters
print('Optimal parameters')
tau = c[0]
theta = c[1]
print(c)
# calculate prediction
yp = yfcn(t,tau,theta)
# calculate r^2
print('R^2: ', r2_score(yp,ym))
# plot data and prediciton
plt.figure()
plt.title('Step Test Regression')
plt.plot(t,ym,'ro',label='Measured')
plt.plot(t,yp,'b-',label='Predicted')
plt.ylabel('Response')
plt.xlabel('Time (min)')
plt.legend(loc='best')
plt.show()
Changed lines 514-519 from:
** [[Main/ExcelEulers|Differential Equation
** Excel [[https
** (:toggle hide hw5_1 button show="Solution 1 (Python)":)
(:div id=hw5_1
to:
** (:toggle hide hw4_3 button show="Solution 3 (Python)":)
(:div id=hw4_3:)
(:div id=hw4_3:)
Changed lines 517-536 from:
to:
import numpy as np
import matplotlib.pyplot as plt
# generate 1000 random numbers
# with Poisson distribution and lambda=1
n = 1000
lam = 1
x = np.random.poisson(lam,n)
# count number in each bin
bins=[0,1,2,3,4,5,6]
hist, _ = np.histogram(x, bins)
# plot histogram data
plt.bar(bins[0:-1],hist,label='1000 samples')
plt.xlabel('bin')
plt.ylabel('count')
plt.title('Poisson Distribution (lambda=1)')
plt.legend(loc='best')
plt.show()
import matplotlib.pyplot as plt
# generate 1000 random numbers
# with Poisson distribution and lambda=1
n = 1000
lam = 1
x = np.random.poisson(lam,n)
# count number in each bin
bins=[0,1,2,3,4,5,6]
hist, _ = np.histogram(x, bins)
# plot histogram data
plt.bar(bins[0:-1],hist,label='1000 samples')
plt.xlabel('bin')
plt.ylabel('count')
plt.title('Poisson Distribution (lambda=1)')
plt.legend(loc='best')
plt.show()
Changed lines 539-540 from:
** (:toggle hide hw5_2 button show="Solution 2 (Python)":)
(:div id=hw5_2:)
(:div id=hw5_2
to:
*[[Attach:hw5.pdf|Assignment #5]]
** [[Main/ExcelEulers|Differential Equation Solution]]
** Excel [[https://youtu.be/cc8CuFTX5CI|Solution 1]], [[https://youtu.be/ySrMlC-bnGM|Solution 2]]
** (:toggle hide hw5_1ab button show="Solution 1ab (Python)":)
(:div id=hw5_1ab:)
Changed lines 546-601 from:
to:
import numpy as np
import matplotlib.pyplot as plt
from gekko import GEKKO
from scipy.integrate import odeint
# number of time points
n = 15
# final time
tf = 7.0
# initial concentration
Ca0 = 5.0
# constants
k = 1 # 1/s
# method #1 Analytical solution
# Ca(t) = Ca(0) * exp(-k*t)
t = np.linspace(0,tf,n)
Ca_m1 = Ca0 * np.exp(-k*t)
# method #2 Euler's method
Ca_m2 = np.empty(n)
Ca_m2[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t[i] - t[i-1]
Ca_m2[i] = Ca_m2[i-1] - k * Ca_m2[i-1] * dt
# method #3: GEKKO solution
# create new gekko model
m = GEKKO()
# integration time points
m.time = t
# variables
Ca = m.Var(value=Ca0)
# differential equation
m.Equation(Ca.dt()==-k*Ca)
# set options
m.options.IMODE = 4 # dynamic simulation
m.options.NODES = 3 # collocation nodes
# simulate ODE
m.solve()
# method #4: ODEINT from SciPy
def dCadt(t,Ca):
return -k * Ca
Ca_m4 = odeint(dCadt,t,Ca0)
# plot results
plt.figure(1)
plt.plot(t,Ca_m1,'r-',label='Ca (Analytical)')
plt.plot(t,Ca_m2,'ko',label='Ca (Euler)')
plt.plot(t,Ca,'b--',label='Ca (GEKKO)')
plt.plot(t,Ca,'ys',label='Ca (ODEINT)')
plt.xlabel('Time (sec)')
plt.ylabel(r'$C_a (kmol/m^3)$')
plt.legend(loc='best')
plt.show()
import matplotlib.pyplot as plt
from gekko import GEKKO
from scipy.integrate import odeint
# number of time points
n = 15
# final time
tf = 7.0
# initial concentration
Ca0 = 5.0
# constants
k = 1 # 1/s
# method #1 Analytical solution
# Ca(t) = Ca(0) * exp(-k*t)
t = np.linspace(0,tf,n)
Ca_m1 = Ca0 * np.exp(-k*t)
# method #2 Euler's method
Ca_m2 = np.empty(n)
Ca_m2[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t[i] - t[i-1]
Ca_m2[i] = Ca_m2[i-1] - k * Ca_m2[i-1] * dt
# method #3: GEKKO solution
# create new gekko model
m = GEKKO()
# integration time points
m.time = t
# variables
Ca = m.Var(value=Ca0)
# differential equation
m.Equation(Ca.dt()==-k*Ca)
# set options
m.options.IMODE = 4 # dynamic simulation
m.options.NODES = 3 # collocation nodes
# simulate ODE
m.solve()
# method #4: ODEINT from SciPy
def dCadt(t,Ca):
return -k * Ca
Ca_m4 = odeint(dCadt,t,Ca0)
# plot results
plt.figure(1)
plt.plot(t,Ca_m1,'r-',label='Ca (Analytical)')
plt.plot(t,Ca_m2,'ko',label='Ca (Euler)')
plt.plot(t,Ca,'b--',label='Ca (GEKKO)')
plt.plot(t,Ca,'ys',label='Ca (ODEINT)')
plt.xlabel('Time (sec)')
plt.ylabel(r'$C_a (kmol/m^3)$')
plt.legend(loc='best')
plt.show()
Changed lines 604-609 from:
** [[Main/VbaMacro|VBA Macros]]
** Excel [[https
** (:toggle hide hw6_1 button show="Solution 1 (Python)":)
(:div id=hw6_1
to:
** (:toggle hide hw5_1c button show="Solution 1c (Python)":)
(:div id=hw5_1c:)
(:div id=hw5_1c:)
Changed lines 607-660 from:
to:
import numpy as np
import matplotlib.pyplot as plt
from gekko import GEKKO
from scipy.integrate import odeint
# number of time points
n = 15
# final time
tf = 7.0
# initial concentration
Ca0 = 5.0
# constants
k = 1 # 1/s
# method #1 Analytical solution
# Ca(t) = Ca(0) * exp(-k*t)
t = np.linspace(0,tf,n)
Ca_m1 = Ca0 * np.exp(-k*t)
# method #2 Euler's method
t2 = np.arange(0,tf,0.5)
n = len(t2)
Ca_m2 = np.empty_like(t2)
Ca_m2[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t2[i] - t2[i-1]
Ca_m2[i] = Ca_m2[i-1] - k * Ca_m2[i-1] * dt
t3 = np.arange(0,tf,1.5)
n = len(t3)
Ca_m3 = np.empty_like(t3)
Ca_m3[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t3[i] - t3[i-1]
Ca_m3[i] = Ca_m3[i-1] - k * Ca_m3[i-1] * dt
t4 = np.arange(0,tf,2.1)
n = len(t4)
Ca_m4 = np.empty_like(t4)
Ca_m4[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t4[i] - t4[i-1]
Ca_m4[i] = Ca_m4[i-1] - k * Ca_m4[i-1] * dt
# plot results
plt.figure(1)
plt.plot(t,Ca_m1,'r-',label='Ca (Analytical)')
plt.plot(t2,Ca_m2,'k.-',label='Ca (Euler 0.5)')
plt.plot(t3,Ca_m3,'bo-',label='Ca (Euler 1.5)')
plt.plot(t4,Ca_m4,'y--',label='Ca (Euler 2.1)')
plt.xlabel('Time (sec)')
plt.ylabel(r'$C_a (kmol/m^3)$')
plt.legend(loc='best')
plt.show()
import matplotlib.pyplot as plt
from gekko import GEKKO
from scipy.integrate import odeint
# number of time points
n = 15
# final time
tf = 7.0
# initial concentration
Ca0 = 5.0
# constants
k = 1 # 1/s
# method #1 Analytical solution
# Ca(t) = Ca(0) * exp(-k*t)
t = np.linspace(0,tf,n)
Ca_m1 = Ca0 * np.exp(-k*t)
# method #2 Euler's method
t2 = np.arange(0,tf,0.5)
n = len(t2)
Ca_m2 = np.empty_like(t2)
Ca_m2[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t2[i] - t2[i-1]
Ca_m2[i] = Ca_m2[i-1] - k * Ca_m2[i-1] * dt
t3 = np.arange(0,tf,1.5)
n = len(t3)
Ca_m3 = np.empty_like(t3)
Ca_m3[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t3[i] - t3[i-1]
Ca_m3[i] = Ca_m3[i-1] - k * Ca_m3[i-1] * dt
t4 = np.arange(0,tf,2.1)
n = len(t4)
Ca_m4 = np.empty_like(t4)
Ca_m4[0] = Ca0 # kmol/m^3
for i in range(1,n):
dt = t4[i] - t4[i-1]
Ca_m4[i] = Ca_m4[i-1] - k * Ca_m4[i-1] * dt
# plot results
plt.figure(1)
plt.plot(t,Ca_m1,'r-',label='Ca (Analytical)')
plt.plot(t2,Ca_m2,'k.-',label='Ca (Euler 0.5)')
plt.plot(t3,Ca_m3,'bo-',label='Ca (Euler 1.5)')
plt.plot(t4,Ca_m4,'y--',label='Ca (Euler 2.1)')
plt.xlabel('Time (sec)')
plt.ylabel(r'$C_a (kmol/m^3)$')
plt.legend(loc='best')
plt.show()
Changed lines 663-664 from:
** (:toggle hide hw6_2 button show="Solution 2 (Python)":)
(:div id=hw6_2:)
(:div id=
to:
** (:toggle hide hw5_2 button show="Solution 2 (Python)":)
(:div id=hw5_2:)
(:div id=hw5_2:)
Changed lines 666-744 from:
to:
import numpy as np
import matplotlib.pyplot as plt
from gekko import GEKKO
# final time
tf = 3.0
# constants
k1 = 1.0 # L/mol-s
k2 = 1.5 # L/mol-s
# GEKKO solution
# create new gekko model
m = GEKKO()
# integration time points
m.time = np.arange(0,tf+0.01,0.2)
# variables
Ca = m.Var(value=1.0)
Cb = m.Var(value=1.0)
Cc = m.Var(value=0.0)
Cd = m.Var(value=0.0)
S = m.Var(value=1.0)
# differential equations
m.Equation(Ca.dt()==-k1*Ca*Cb)
m.Equation(Cb.dt()==-k1*Ca*Cb-k2*Cb*Cc)
m.Equation(Cc.dt()== k1*Ca*Cb-k2*Cb*Cc)
m.Equation(Cd.dt()== k2*Cb*Cc)
m.Equation(S==Cc/(Cc+Cd))
# set options
m.options.IMODE = 4 # dynamic simulation
m.options.NODES = 3 # collocation nodes
# simulate ODE
m.solve()
# plot results
plt.figure(1)
plt.subplot(2,1,1)
plt.plot(m.time,Ca,'r-',label='Ca',linewidth=2.0)
plt.plot(m.time,Cb,'k.-',label='Cb',linewidth=2.0)
plt.plot(m.time,Cc,'b--',label='Cc',linewidth=2.0)
plt.plot(m.time,Cd,'y:',label='Cd',linewidth=3.0)
plt.ylabel('Conc (mol/L)')
plt.legend(loc='best')
plt.subplot(2,1,2)
plt.plot(m.time,S,'k-',label='Selectivity',linewidth=2.0)
plt.xlabel('Time (sec)')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
*[[Attach:hw6.pdf|Assignment #6]]
** [[Main/VbaMacro|VBA Macros]]
** Excel [[https://youtu.be/bHwFTDp5g6A|Solution 1]], [[https://youtu.be/0C6QMin5OZc|Solution 2]]
** (:toggle hide hw6_1 button show="Solution 1 (Python)":)
(:div id=hw6_1:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw6_2 button show="Solution 2 (Python)":)
(:div id=hw6_2:)
(:source lang=python:)
import numpy as np
r = 5 # m
h = 10 # m
F = 15 # m^3/min
t = 180 # min
V_tank = np.pi * r**2 * h # m^3
V_crude_oil = F * t # m^3
if V_crude_oil > V_tank:
print('Tank Overfilled by ' \
+ str(V_crude_oil-V_tank) + ' m^3')
else:
print('Not Overfilled')
import matplotlib.pyplot as plt
from gekko import GEKKO
# final time
tf = 3.0
# constants
k1 = 1.0 # L/mol-s
k2 = 1.5 # L/mol-s
# GEKKO solution
# create new gekko model
m = GEKKO()
# integration time points
m.time = np.arange(0,tf+0.01,0.2)
# variables
Ca = m.Var(value=1.0)
Cb = m.Var(value=1.0)
Cc = m.Var(value=0.0)
Cd = m.Var(value=0.0)
S = m.Var(value=1.0)
# differential equations
m.Equation(Ca.dt()==-k1*Ca*Cb)
m.Equation(Cb.dt()==-k1*Ca*Cb-k2*Cb*Cc)
m.Equation(Cc.dt()== k1*Ca*Cb-k2*Cb*Cc)
m.Equation(Cd.dt()== k2*Cb*Cc)
m.Equation(S==Cc/(Cc+Cd))
# set options
m.options.IMODE = 4 # dynamic simulation
m.options.NODES = 3 # collocation nodes
# simulate ODE
m.solve()
# plot results
plt.figure(1)
plt.subplot(2,1,1)
plt.plot(m.time,Ca,'r-',label='Ca',linewidth=2.0)
plt.plot(m.time,Cb,'k.-',label='Cb',linewidth=2.0)
plt.plot(m.time,Cc,'b--',label='Cc',linewidth=2.0)
plt.plot(m.time,Cd,'y:',label='Cd',linewidth=3.0)
plt.ylabel('Conc (mol/L)')
plt.legend(loc='best')
plt.subplot(2,1,2)
plt.plot(m.time,S,'k-',label='Selectivity',linewidth=2.0)
plt.xlabel('Time (sec)')
plt.legend(loc='best')
plt.show()
(:sourceend:)
(:divend:)
*[[Attach:hw6.pdf|Assignment #6]]
** [[Main/VbaMacro|VBA Macros]]
** Excel [[https://youtu.be/bHwFTDp5g6A|Solution 1]], [[https://youtu.be/0C6QMin5OZc|Solution 2]]
** (:toggle hide hw6_1 button show="Solution 1 (Python)":)
(:div id=hw6_1:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw6_2 button show="Solution 2 (Python)":)
(:div id=hw6_2:)
(:source lang=python:)
import numpy as np
r = 5 # m
h = 10 # m
F = 15 # m^3/min
t = 180 # min
V_tank = np.pi * r**2 * h # m^3
V_crude_oil = F * t # m^3
if V_crude_oil > V_tank:
print('Tank Overfilled by ' \
+ str(V_crude_oil-V_tank) + ' m^3')
else:
print('Not Overfilled')
Changed lines 266-294 from:
to:
import numpy as np
from scipy.optimize import fsolve
# constants
TC = 77 # degC
P = 1.0 # bar
a = 2.877e8 # cm^6 bar K^0.5 / mol^2
b = 60.211 # cm^3 / mol
Rg = 83.144598 # cm^3 bar / K-mol
# derived quantities
TK = TC+273.15 # K
# method #1: NumPy
def f(V):
return P - Rg*TK/(V-b)+a/(np.sqrt(TK)*V*(V+b))
V_liq = fsolve(f,82) # Liquid root
V_vap = fsolve(f,28600) # Vapor root
print('NumPy Solution')
print(V_liq,V_vap)
# method #2: Gekko
from gekko import GEKKO
m = GEKKO()
V = m.Var(value=[82,28600])
m.Equation(P==Rg*TK/(V-b)-a/(m.sqrt(TK)*V*(V+b)))
m.options.IMODE=2
m.solve(disp=False)
print('Gekko Solution')
print(V.value)
from scipy.optimize import fsolve
# constants
TC = 77 # degC
P = 1.0 # bar
a = 2.877e8 # cm^6 bar K^0.5 / mol^2
b = 60.211 # cm^3 / mol
Rg = 83.144598 # cm^3 bar / K-mol
# derived quantities
TK = TC+273.15 # K
# method #1: NumPy
def f(V):
return P - Rg*TK/(V-b)+a/(np.sqrt(TK)*V*(V+b))
V_liq = fsolve(f,82) # Liquid root
V_vap = fsolve(f,28600) # Vapor root
print('NumPy Solution')
print(V_liq,V_vap)
# method #2: Gekko
from gekko import GEKKO
m = GEKKO()
V = m.Var(value=[82,28600])
m.Equation(P==Rg*TK/(V-b)-a/(m.sqrt(TK)*V*(V+b)))
m.options.IMODE=2
m.solve(disp=False)
print('Gekko Solution')
print(V.value)
Changed lines 7-8 from:
Complete the following assignments with Microsoft Excel, Google Sheets, or another equivalent spreadsheet program. Python solutions are also shown as a reference and introduction but not required.
to:
Complete the following assignments with Microsoft Excel, Google Sheets, or another similar spreadsheet program. Microsoft Excel solutions are shown for each problem but should only be used as a learning resource, not to merely complete the assignment. Python solutions are shown as a reference and introduction to programming but are not required.
Changed line 12 from:
** [[https://youtu.be/VPjoNrtm8wk|Solution 2]], [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
to:
** Excel [[https://youtu.be/VPjoNrtm8wk|Solution 2]], [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
Changed line 63 from:
plt.contourf(Tm,Vm,Pm,cmap='RdBu_r')
to:
plt.contourf(Vm,Tm,Pm,cmap='RdBu_r')
Changed line 65 from:
CS2 = plt.contour(Tm,Vm,Pm,[1.0,2.5],colors='k')
to:
CS2 = plt.contour(Vm,Tm,Pm,[1.0,2.5],colors='k')
Changed lines 67-68 from:
plt.xlabel('Temperature (K)')
plt.ylabel('Volume (L)')
plt.ylabel('
to:
plt.xlabel('Volume (L)')
plt.ylabel('Temperature (K)')
plt.ylabel('Temperature (K)')
Changed line 76 from:
** [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/6vFynd2bGoQ|Solution 2]], [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
to:
** Excel [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/6vFynd2bGoQ|Solution 2]], [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
Added lines 80-119:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# import April 2018 data or get new data from finance.yahoo.com
appl = pd.read_csv('https://apmonitor.com/che263/uploads/Main/AAPL.csv')
goog = pd.read_csv('https://apmonitor.com/che263/uploads/Main/GOOG.csv')
#xom = pd.read_csv('https://apmonitor.com/che263/uploads/Main/XOM.csv')
# create dictionary of stocks
s = dict([('Apple',appl),('Google',goog)]) #,('ExxonMobil',xom)])
# print column headers and starting rows (5 is default)
print('Apple Data')
print(s['Apple'].head())
# print column headers and ending close price (4 rows)
print('Google Data')
print(s['Google']['Close'].tail(4))
# basic data statistics
for i in s:
print('Stock: ' + i)
print(' max : ' + str(max(s[i]['Close'])))
print(' min : ' + str(min(s[i]['Close'])))
print(' stdev : ' + str(np.std(s[i]['Close'])))
print(' avg : ' + str(np.mean(s[i]['Close'])))
print(' median: ' + str(np.median(s[i]['Close'])))
# plot data
plt.figure()
sty = dict([('Apple','r--'),('Google','b:'),('ExxonMobil','k-')])
ni = 0
for i in s:
mc = max(s[i]['Close'])
plt.plot(s[i]['Date'],s[i]['Close']/mc,sty[i],linewidth=3,label=i)
plt.plot(s[i]['Date'],s[i]['High']/mc,sty[i],linewidth=1)
plt.plot(s[i]['Date'],s[i]['Low']/mc,sty[i],linewidth=1)
plt.xticks(rotation=90)
plt.legend(loc='best')
plt.show()
import matplotlib.pyplot as plt
import numpy as np
# import April 2018 data or get new data from finance.yahoo.com
appl = pd.read_csv('https://apmonitor.com/che263/uploads/Main/AAPL.csv')
goog = pd.read_csv('https://apmonitor.com/che263/uploads/Main/GOOG.csv')
#xom = pd.read_csv('https://apmonitor.com/che263/uploads/Main/XOM.csv')
# create dictionary of stocks
s = dict([('Apple',appl),('Google',goog)]) #,('ExxonMobil',xom)])
# print column headers and starting rows (5 is default)
print('Apple Data')
print(s['Apple'].head())
# print column headers and ending close price (4 rows)
print('Google Data')
print(s['Google']['Close'].tail(4))
# basic data statistics
for i in s:
print('Stock: ' + i)
print(' max : ' + str(max(s[i]['Close'])))
print(' min : ' + str(min(s[i]['Close'])))
print(' stdev : ' + str(np.std(s[i]['Close'])))
print(' avg : ' + str(np.mean(s[i]['Close'])))
print(' median: ' + str(np.median(s[i]['Close'])))
# plot data
plt.figure()
sty = dict([('Apple','r--'),('Google','b:'),('ExxonMobil','k-')])
ni = 0
for i in s:
mc = max(s[i]['Close'])
plt.plot(s[i]['Date'],s[i]['Close']/mc,sty[i],linewidth=3,label=i)
plt.plot(s[i]['Date'],s[i]['High']/mc,sty[i],linewidth=1)
plt.plot(s[i]['Date'],s[i]['Low']/mc,sty[i],linewidth=1)
plt.xticks(rotation=90)
plt.legend(loc='best')
plt.show()
Added lines 125-151:
import pandas as pd
import matplotlib.pyplot as plt
# import data
# Time (sec), Heater 1, Heater 2, Temperature 1, Temperature 2
x = pd.read_csv('https://apmonitor.com/che263/uploads/Main/tclab.txt')
# print column headers and starting 10 rows (5 is default)
print('Data')
print(x.head(10))
# plot data
plt.figure()
plt.subplot(2,1,1)
plt.title('Temperature Control Lab')
plt.plot(x['Time (sec)'],x['Temperature 1'],'r--')
plt.plot(x['Time (sec)'],x['Temperature 2'],'b-')
plt.ylabel('Temp (degC)')
plt.legend(loc='best')
plt.subplot(2,1,2)
plt.plot(x['Time (sec)'],x['Heater 1'],'r--')
plt.plot(x['Time (sec)'],x['Heater 2'],'b-')
plt.ylabel('Heater (%)')
plt.xlabel('Time (sec)')
plt.legend(loc='best')
plt.show()
import matplotlib.pyplot as plt
# import data
# Time (sec), Heater 1, Heater 2, Temperature 1, Temperature 2
x = pd.read_csv('https://apmonitor.com/che263/uploads/Main/tclab.txt')
# print column headers and starting 10 rows (5 is default)
print('Data')
print(x.head(10))
# plot data
plt.figure()
plt.subplot(2,1,1)
plt.title('Temperature Control Lab')
plt.plot(x['Time (sec)'],x['Temperature 1'],'r--')
plt.plot(x['Time (sec)'],x['Temperature 2'],'b-')
plt.ylabel('Temp (degC)')
plt.legend(loc='best')
plt.subplot(2,1,2)
plt.plot(x['Time (sec)'],x['Heater 1'],'r--')
plt.plot(x['Time (sec)'],x['Heater 2'],'b-')
plt.ylabel('Heater (%)')
plt.xlabel('Time (sec)')
plt.legend(loc='best')
plt.show()
Added lines 157-197:
import math as m
# part a
help(m.cos)
y = m.cos(0.5)
print('cos(0.5): ' + str(y))
# part b
y = m.sin(30.0*(m.pi/180.0))
print('sin(30 deg): ' + str(y))
# part c
y = m.tan(m.pi/2.0)
print('tan(pi/x): ' + str(y))
# part d
x = 5.0
y = max(2.0*m.sqrt(x),(x**2)/2.0,\
(x**3)/3.0,(x**2+x**3)/5.0)
print('max value: ' + str(y))
# part e
x = 25
y = m.factorial(x)
print('25!: ' + str(y))
# part f
x = 0.5
# if..else statement
if x<1.0:
y = x**2
else:
y = m.sin(m.pi*x/2.0)
# same but one line
y = x**2 if x<1.0 else m.sin(m.pi*x/2.0)
print('if statement result: ' + str(y))
# part g
x = 4.999
y = m.floor(x)
print('floor(4.999): ' + str(y))
# part a
help(m.cos)
y = m.cos(0.5)
print('cos(0.5): ' + str(y))
# part b
y = m.sin(30.0*(m.pi/180.0))
print('sin(30 deg): ' + str(y))
# part c
y = m.tan(m.pi/2.0)
print('tan(pi/x): ' + str(y))
# part d
x = 5.0
y = max(2.0*m.sqrt(x),(x**2)/2.0,\
(x**3)/3.0,(x**2+x**3)/5.0)
print('max value: ' + str(y))
# part e
x = 25
y = m.factorial(x)
print('25!: ' + str(y))
# part f
x = 0.5
# if..else statement
if x<1.0:
y = x**2
else:
y = m.sin(m.pi*x/2.0)
# same but one line
y = x**2 if x<1.0 else m.sin(m.pi*x/2.0)
print('if statement result: ' + str(y))
# part g
x = 4.999
y = m.floor(x)
print('floor(4.999): ' + str(y))
Changed lines 203-204 from:
to:
** Excel [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]], [[https://youtu.be/GMC31hEhFMg|Solution 3]], [[https://youtu.be/7HDO0ORwjn0|Solution 4]]
** (:toggle hide hw3_1 button show="Solution 1 (Python)":)
(:div id=hw3_1:)
(:source lang=python:)
# method #1: NumPy
from numpy.linalg import solve
A = [[11.0, 3.0, 0.0, 1.0, 2.0],\
[ 0.0, 4.0, 2.0, 0.0, 1.0],\
[ 3.0, 2.0, 7.0, 1.0, 0.0],\
[ 4.0, 0.0, 4.0, 10.0, 1.0],\
[ 2.0, 5.0, 1.0, 3.0, 14.0]]
b = [45.0, 30.0, 15.0, 20.0, 92.0]
x = solve(A,b)
print('NumPy Solution')
print(x)
# method #2: Gekko
from gekko import GEKKO
m = GEKKO()
x1,x2,x3,x4,x5 = [m.Var() for i in range(5)]
m.Equation(11*x1+3*x2+x4+2*x5==45)
m.Equation(4*x2+2*x3+x5==30)
m.Equation(3*x1+2*x2+7*x3+x4==15)
m.Equation(4*x1+4*x3+10*x4+x5==20)
m.Equation(2*x1+5*x2+x3+3*x4+14*x5==92)
m.solve(disp=False)
print('Gekko Solution')
print(x1.value)
print(x2.value)
print(x3.value)
print(x4.value)
print(x5.value)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_2 button show="Solution 2 (Python)":)
(:div id=hw3_2:)
(:source lang=python:)
# method #1: NumPy
from scipy.optimize import fsolve
def f(z):
x,y=z
f1 = 2*x**2+y**2-1
f2 = (0.5*x-0.5)**2+2.0*(y-0.25)**2-1
return [f1,f2]
x,y = fsolve(f,[1,1])
print('NumPy Solution')
print(x,y)
# method #2: Gekko
from gekko import GEKKO
m = GEKKO()
x,y = [m.Var(value=1) for i in range(2)]
m.Equation(2*x**2+y**2==1)
m.Equation((0.5*x-0.5)**2+2.0*(y-0.25)**2==1)
m.solve(disp=False)
print('Gekko Solution')
print(x.value)
print(y.value)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_3 button show="Solution 3 (Python)":)
(:div id=hw3_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_4 button show="Solution 3 (Python)":)
(:div id=hw3_4:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_1 button show="Solution 1 (Python)":)
(:div id=hw3_1:)
(:source lang=python:)
# method #1: NumPy
from numpy.linalg import solve
A = [[11.0, 3.0, 0.0, 1.0, 2.0],\
[ 0.0, 4.0, 2.0, 0.0, 1.0],\
[ 3.0, 2.0, 7.0, 1.0, 0.0],\
[ 4.0, 0.0, 4.0, 10.0, 1.0],\
[ 2.0, 5.0, 1.0, 3.0, 14.0]]
b = [45.0, 30.0, 15.0, 20.0, 92.0]
x = solve(A,b)
print('NumPy Solution')
print(x)
# method #2: Gekko
from gekko import GEKKO
m = GEKKO()
x1,x2,x3,x4,x5 = [m.Var() for i in range(5)]
m.Equation(11*x1+3*x2+x4+2*x5==45)
m.Equation(4*x2+2*x3+x5==30)
m.Equation(3*x1+2*x2+7*x3+x4==15)
m.Equation(4*x1+4*x3+10*x4+x5==20)
m.Equation(2*x1+5*x2+x3+3*x4+14*x5==92)
m.solve(disp=False)
print('Gekko Solution')
print(x1.value)
print(x2.value)
print(x3.value)
print(x4.value)
print(x5.value)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_2 button show="Solution 2 (Python)":)
(:div id=hw3_2:)
(:source lang=python:)
# method #1: NumPy
from scipy.optimize import fsolve
def f(z):
x,y=z
f1 = 2*x**2+y**2-1
f2 = (0.5*x-0.5)**2+2.0*(y-0.25)**2-1
return [f1,f2]
x,y = fsolve(f,[1,1])
print('NumPy Solution')
print(x,y)
# method #2: Gekko
from gekko import GEKKO
m = GEKKO()
x,y = [m.Var(value=1) for i in range(2)]
m.Equation(2*x**2+y**2==1)
m.Equation((0.5*x-0.5)**2+2.0*(y-0.25)**2==1)
m.solve(disp=False)
print('Gekko Solution')
print(x.value)
print(y.value)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_3 button show="Solution 3 (Python)":)
(:div id=hw3_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw3_4 button show="Solution 3 (Python)":)
(:div id=hw3_4:)
(:source lang=python:)
(:sourceend:)
(:divend:)
Changed lines 278-279 from:
** [[https://youtu.be/X4jneorGsls|Solution 1]], [[https://youtu.be/eXco8_3MmjI|Solution 2]], [[https://youtu.be/kehsHfFMsAE|Solution 3]]
to:
** Excel [[https://youtu.be/X4jneorGsls|Solution 1]], [[https://youtu.be/eXco8_3MmjI|Solution 2]], [[https://youtu.be/kehsHfFMsAE|Solution 3]]
** (:toggle hide hw4_1 button show="Solution 1 (Python)":)
(:div id=hw4_1:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw4_2 button show="Solution 2 (Python)":)
(:div id=hw4_2:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw4_3 button show="Solution 3 (Python)":)
(:div id=hw4_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw4_1 button show="Solution 1 (Python)":)
(:div id=hw4_1:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw4_2 button show="Solution 2 (Python)":)
(:div id=hw4_2:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw4_3 button show="Solution 3 (Python)":)
(:div id=hw4_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
Changed lines 300-301 from:
** [[https://youtu.be/cc8CuFTX5CI|Solution 1]], [[https://youtu.be/ySrMlC-bnGM|Solution 2]]
to:
** Excel [[https://youtu.be/cc8CuFTX5CI|Solution 1]], [[https://youtu.be/ySrMlC-bnGM|Solution 2]]
** (:toggle hide hw5_1 button show="Solution 1 (Python)":)
(:div id=hw5_1:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw5_2 button show="Solution 2 (Python)":)
(:div id=hw5_2:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw5_1 button show="Solution 1 (Python)":)
(:div id=hw5_1:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw5_2 button show="Solution 2 (Python)":)
(:div id=hw5_2:)
(:source lang=python:)
(:sourceend:)
(:divend:)
Changed lines 316-328 from:
** [[https://youtu.be/bHwFTDp5g6A|Solution 1]], [[https://youtu.be/0C6QMin5OZc|Solution 2]]
to:
** Excel [[https://youtu.be/bHwFTDp5g6A|Solution 1]], [[https://youtu.be/0C6QMin5OZc|Solution 2]]
** (:toggle hide hw6_1 button show="Solution 1 (Python)":)
(:div id=hw6_1:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw6_2 button show="Solution 2 (Python)":)
(:div id=hw6_2:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw6_1 button show="Solution 1 (Python)":)
(:div id=hw6_1:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw6_2 button show="Solution 2 (Python)":)
(:div id=hw6_2:)
(:source lang=python:)
(:sourceend:)
(:divend:)
Added lines 6-7:
Complete the following assignments with Microsoft Excel, Google Sheets, or another equivalent spreadsheet program. Python solutions are also shown as a reference and introduction but not required.
Changed line 76 from:
(:div id=hw1_3:)
to:
(:div id=hw2_1:)
Changed line 81 from:
(:div id=hw1_3:)
to:
(:div id=hw2_2:)
Changed line 86 from:
(:div id=hw1_3:)
to:
(:div id=hw2_3:)
Changed lines 35-70 from:
to:
** (:toggle hide hw1_3 button show="Solution 3 (Python)":)
(:div id=hw1_3:)
%width=500px%Attach:pressure_contour.png
(:source lang=python:)
import numpy as np
import matplotlib.pyplot as plt
# calculate initial moles of N2
T = 298.15 # K
P = 1.25 # atm
V = 4000 # L
Rg = 0.0821 # L*atm/mol/K
n_N2 = P*V/(Rg*T) # moles of N2
n_N2 = n_N2 * 0.25 # moles with 25% remaining
# calculate N2 pressure at different V and T
n = 20 # grid points
V = np.linspace(500,1000,n)
T = np.linspace(100,600,n)
# create meshgrid
Vm,Tm = np.meshgrid(V,T)
# calculate pressure
Pm = n_N2 * Rg * Tm / Vm
# plot results
plt.figure()
plt.contourf(Tm,Vm,Pm,cmap='RdBu_r')
plt.colorbar()
CS2 = plt.contour(Tm,Vm,Pm,[1.0,2.5],colors='k')
plt.clabel(CS2, inline=1, fontsize=10)
plt.xlabel('Temperature (K)')
plt.ylabel('Volume (L)')
plt.show()
(:sourceend:)
(:divend:)
(:div id=hw1_3:)
%width=500px%Attach:pressure_contour.png
(:source lang=python:)
import numpy as np
import matplotlib.pyplot as plt
# calculate initial moles of N2
T = 298.15 # K
P = 1.25 # atm
V = 4000 # L
Rg = 0.0821 # L*atm/mol/K
n_N2 = P*V/(Rg*T) # moles of N2
n_N2 = n_N2 * 0.25 # moles with 25% remaining
# calculate N2 pressure at different V and T
n = 20 # grid points
V = np.linspace(500,1000,n)
T = np.linspace(100,600,n)
# create meshgrid
Vm,Tm = np.meshgrid(V,T)
# calculate pressure
Pm = n_N2 * Rg * Tm / Vm
# plot results
plt.figure()
plt.contourf(Tm,Vm,Pm,cmap='RdBu_r')
plt.colorbar()
CS2 = plt.contour(Tm,Vm,Pm,[1.0,2.5],colors='k')
plt.clabel(CS2, inline=1, fontsize=10)
plt.xlabel('Temperature (K)')
plt.ylabel('Volume (L)')
plt.show()
(:sourceend:)
(:divend:)
Added lines 75-89:
** (:toggle hide hw2_1 button show="Solution 1 (Python)":)
(:div id=hw1_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw2_2 button show="Solution 2 (Python)":)
(:div id=hw1_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw2_3 button show="Solution 3 (Python)":)
(:div id=hw1_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
(:div id=hw1_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw2_2 button show="Solution 2 (Python)":)
(:div id=hw1_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
** (:toggle hide hw2_3 button show="Solution 3 (Python)":)
(:div id=hw1_3:)
(:source lang=python:)
(:sourceend:)
(:divend:)
Added lines 11-34:
** (:toggle hide hw1_2 button show="Solution 2 (Python)":)
(:div id=hw1_2:)
(:source lang=python:)
# constants
L = 2 # m
Tplate = 343 # K
v = 1.45 # m/s
Twater = 294 # K
mu = 9.79e-4 # Pa*s
rho = 998 # kg/m^3
k = 0.601 # W/m-K
cp = 4.18e3 # J/kg-K
# derived quantities
Re = rho*L*v/mu
Pr = mu*cp/k
Nu = 0.332 * Pr**(1.0/3.0) * Re**(1.0/2.0)
h = Nu * k / L
q = h * (Tplate-Twater)
print('Rate of Heat Transfer')
print(str(q)+' W/m^2')
(:sourceend:)
(:divend:)
(:div id=hw1_2:)
(:source lang=python:)
# constants
L = 2 # m
Tplate = 343 # K
v = 1.45 # m/s
Twater = 294 # K
mu = 9.79e-4 # Pa*s
rho = 998 # kg/m^3
k = 0.601 # W/m-K
cp = 4.18e3 # J/kg-K
# derived quantities
Re = rho*L*v/mu
Pr = mu*cp/k
Nu = 0.332 * Pr**(1.0/3.0) * Re**(1.0/2.0)
h = Nu * k / L
q = h * (Tplate-Twater)
print('Rate of Heat Transfer')
print(str(q)+' W/m^2')
(:sourceend:)
(:divend:)
Changed line 23 from:
** [[https://youtu.be/eXco8_3MmjI|Solution 2]], [[https://youtu.be/kehsHfFMsAE|Solution 3]]
to:
** [[https://youtu.be/X4jneorGsls|Solution 1]], [[https://youtu.be/eXco8_3MmjI|Solution 2]], [[https://youtu.be/kehsHfFMsAE|Solution 3]]
Changed line 21 from:
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]]
to:
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Excel Template]] - [[Attach:heart_rate.txt|HR Data]] - [[Attach:dynamics.txt|Dynamics Data]]
Changed line 15 from:
** [[https://youtu.be/CchyR-vmFbk|Solution 1]], Solution 2, [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
to:
** [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/6vFynd2bGoQ|Solution 2]], [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
Changed line 12 from:
*[[Attach:hw2.pdf|Assignment #2]] - [[Attach:tclab_steps.txt|Problem 2 Data File]]
to:
*[[Attach:hw2.pdf|Assignment #2]] - [[Attach:tclab.txt|Problem 2 Data File]]
Changed line 15 from:
** [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|Solution 2]], Solution 3
to:
** [[https://youtu.be/CchyR-vmFbk|Solution 1]], Solution 2, [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
Changed line 12 from:
*[[Attach:hw2.pdf|Assignment #2]] - [[Attach:tclab_steps.txt|HW2, Problem 3 Data File]]
to:
*[[Attach:hw2.pdf|Assignment #2]] - [[Attach:tclab_steps.txt|Problem 2 Data File]]
Changed line 15 from:
** [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|Solution 2]], [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
to:
** [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|Solution 2]], Solution 3
Changed line 12 from:
*[[Attach:hw2.pdf|Assignment #2]] - [[Attach:tclab_steps.txt|Problem 3 Data File]]
to:
*[[Attach:hw2.pdf|Assignment #2]] - [[Attach:tclab_steps.txt|HW2, Problem 3 Data File]]
Changed line 12 from:
*[[Attach:hw2.pdf|Assignment #2]]
to:
*[[Attach:hw2.pdf|Assignment #2]] - [[Attach:tclab_steps.txt|Problem 3 Data File]]
Changed line 85 from:
** [[https://youtu.be/QlRB2k9i4gc | Solutions 1-7]] and [[https://youtu.be/QlRB2k9i4gc | 8-10]] (Python)
to:
** [[https://youtu.be/QlRB2k9i4gc | Solutions 1-7]] and [[https://youtu.be/6gjYvgIpDo8 | 8-10 (Python)]]
Changed lines 85-86 from:
** [[https://youtu.be/QlRB2k9i4gc | Solutions 1-7 (Python)]]
** [[https://youtu.be/QlRB2k9i4gc | Solutions 8-10 (Python)]]
**
to:
** [[https://youtu.be/QlRB2k9i4gc | Solutions 1-7]] and [[https://youtu.be/QlRB2k9i4gc | 8-10]] (Python)
Added lines 85-86:
** [[https://youtu.be/QlRB2k9i4gc | Solutions 1-7 (Python)]]
** [[https://youtu.be/QlRB2k9i4gc | Solutions 8-10 (Python)]]
** [[https://youtu.be/QlRB2k9i4gc | Solutions 8-10 (Python)]]
Changed lines 83-84 from:
*[[Attach:hw_mathcad_basics.pdf|Assignment #18 - Variables and Equations]]
** [[https://youtu.be/UV7aU7HXv7E | Solutions]]
to:
*[[Attach:hw_mathcad_basics.pdf|Assignment #18 - Variables and Equations (MathCAD)]] and [[Attach:hw_python_basics.zip|(Python)]]
** [[https://youtu.be/UV7aU7HXv7E | Solutions (MathCAD)]]
** [[https://youtu.be/UV7aU7HXv7E | Solutions (MathCAD)]]
Changed line 58 from:
* [[Main/PythonDataAnalysis|File Input and Output]]
to:
** [[Main/PythonDataAnalysis|File Input and Output]]
Changed line 78 from:
** [[https://youtu.be/SFI_l96Oss4|Symbolic Derivatives]]
to:
** [[https://youtu.be/SFI_l96Oss4|Symbolic Derivatives]] and [[https://youtu.be/4grhQ5Y_MWo|Integrals]]
Changed lines 8-9 from:
** Conditions and Functions
to:
** [[Main/ExcelConditionals|Conditionals]]
** [[Main/ExcelFunctions|Functions]]
** [[Main/ExcelFunctions|Functions]]
Changed lines 13-14 from:
** Generate Plots and Data Analysis
to:
** [[Main/ExcelScatterPlots|Generate Plots]]
** [[Main/ExcelDataAnalysis|Data Analysis]]
** [[Main/ExcelDataAnalysis|Data Analysis]]
Changed line 18 from:
** Solve Equations
to:
** [[Main/ExcelSolveEquations|Solve Equations]]
Changed line 22 from:
** Regression
to:
** [[Main/ExcelDataRegression|Data Regression]]
Changed line 26 from:
** Differential Equations
to:
** [[Main/ExcelEulers|Differential Equation Solution]]
Changed line 30 from:
** VBA Macros
to:
** [[Main/VbaMacro|VBA Macros]]
Changed lines 36-37 from:
** [[Main/PythonConditionals|Conditionals]], [[Main/PythonFunctions|Functions]]
to:
** [[Main/PythonConditionals|Conditionals]]
** [[Main/PythonFunctions|Functions]]
** [[Main/PythonFunctions|Functions]]
Changed lines 41-42 from:
** Loops and Arrays
to:
** [[Main/PythonLoops|Loops]]
** [[Main/PythonArrays|Arrays]]
** [[Main/PythonArrays|Arrays]]
Changed line 46 from:
** Plot Data and Correlations
to:
** [[Main/PythonPlots|Generate Plots]]
Changed line 50 from:
** User input, loops, ODEs, and plotting
to:
** [[Main/PythonWidgets|User Interaction]]
Changed line 54 from:
** Debugging
to:
** [[Main/PythonDebug|Debugging]]
Changed line 58 from:
** File Input and Ouput
to:
* [[Main/PythonDataAnalysis|File Input and Output]]
Changed line 62 from:
** Classes (collections of values and functions)
to:
** [[https://youtu.be/LwOg0b0ZwCM|Classes (collections of values and functions)]]
Changed line 66 from:
** Solve Equations (fsolve)
to:
** [[Main/PythonSolveEquations|Solve Equations]]
Changed line 70 from:
** Integration, interpolation, and regression
to:
** [[Main/PythonDataRegression|Data Regression]]
Changed line 74 from:
** Solve differential equations (odeint)
to:
** [[Main/PythonDynamicSim|Solve Differential Equations]]
Changed line 78 from:
** Symbolic solutions (sympy)
to:
** [[https://youtu.be/SFI_l96Oss4|Symbolic Derivatives]]
Changed lines 7-17 from:
*[[Attach:hw1.pdf|Assignment #1]] - [[https://youtu.be/VPjoNrtm8wk|Solution 2]], [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
*[[Attach:hw2.pdf|Assignment #2]]- [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|Solution 2]], [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
*[[Attach:hw3.pdf|Assignment #3]]- [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]], [[https://youtu.be/GMC31hEhFMg|Solution 3]], [[https://youtu.be/7HDO0ORwjn0|Solution 4]]
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]]- [[https://youtu.be/eXco8_3MmjI|Solution 2]], [[https://youtu.be/kehsHfFMsAE|Solution 3]]
*[[Attach:hw5.pdf|Assignment #5]]- [[https://youtu.be/cc8CuFTX5CI|Solution 1]], [[https://youtu.be/ySrMlC-bnGM|Solution 2]]
*[[Attach:hw6.pdf|Assignment #6]]- [[https://youtu.be/bHwFTDp5g6A|Solution 1]], [[https://youtu.be/0C6QMin5OZc|Solution 2]]
*[[Attach:hw2.pdf|Assignment #2]]
*[[Attach:hw3.pdf|Assignment #3]]
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]]
*[[Attach:hw5.pdf|Assignment #5]]
*[[Attach:hw6.pdf|Assignment #6]]
to:
*[[Attach:hw1.pdf|Assignment #1]]
** Conditions and Functions
** [[https://youtu.be/VPjoNrtm8wk|Solution 2]], [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
*[[Attach:hw2.pdf|Assignment #2]]
** Generate Plots and Data Analysis
** [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|Solution 2]], [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
*[[Attach:hw3.pdf|Assignment #3]]
** Solve Equations
** [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]], [[https://youtu.be/GMC31hEhFMg|Solution 3]], [[https://youtu.be/7HDO0ORwjn0|Solution 4]]
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]]
** Regression
** [[https://youtu.be/eXco8_3MmjI|Solution 2]], [[https://youtu.be/kehsHfFMsAE|Solution 3]]
*[[Attach:hw5.pdf|Assignment #5]]
** Differential Equations
** [[https://youtu.be/cc8CuFTX5CI|Solution 1]], [[https://youtu.be/ySrMlC-bnGM|Solution 2]]
*[[Attach:hw6.pdf|Assignment #6]]
** VBA Macros
** [[https://youtu.be/bHwFTDp5g6A|Solution 1]], [[https://youtu.be/0C6QMin5OZc|Solution 2]]
** Conditions and Functions
** [[https://youtu.be/VPjoNrtm8wk|Solution 2]], [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
*[[Attach:hw2.pdf|Assignment #2]]
** Generate Plots and Data Analysis
** [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|Solution 2]], [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
*[[Attach:hw3.pdf|Assignment #3]]
** Solve Equations
** [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]], [[https://youtu.be/GMC31hEhFMg|Solution 3]], [[https://youtu.be/7HDO0ORwjn0|Solution 4]]
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]]
** Regression
** [[https://youtu.be/eXco8_3MmjI|Solution 2]], [[https://youtu.be/kehsHfFMsAE|Solution 3]]
*[[Attach:hw5.pdf|Assignment #5]]
** Differential Equations
** [[https://youtu.be/cc8CuFTX5CI|Solution 1]], [[https://youtu.be/ySrMlC-bnGM|Solution 2]]
*[[Attach:hw6.pdf|Assignment #6]]
** VBA Macros
** [[https://youtu.be/bHwFTDp5g6A|Solution 1]], [[https://youtu.be/0C6QMin5OZc|Solution 2]]
Changed line 22 from:
** Conditionals, Functions
to:
** [[Main/PythonConditionals|Conditionals]], [[Main/PythonFunctions|Functions]]
Changed line 22 from:
** Conditionals, Functions, Loops
to:
** Conditionals, Functions
Changed lines 25-43 from:
*[[Attach:hw8.pdf|Assignment #8]] - [[Attach:hw8.zip|Files]] - [[https://youtu.be/2Y6aMjBYPww|Solutions]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]]- Solution [[https://youtu.be/ziRNzO1T-Mo|1]], [[https://youtu.be/Ql8QPcp8818|2]], [[https://youtu.be/6r5JZjokp-0|3]], [[https://youtu.be/G0ceVjin_cg|4]]
*[[Attach:hw10.pdf|Assignment #10]]- [[https://youtu.be/ouyg_TQGI2Q|Solution 2 (Video)]] - [[Attach:hw10.zip|Solution 2 (.py)]] - [[https://youtu.be/ygoohjN_Lww|Solution 3]]
*[[Attach:hw11.pdf|Assignment #11]] - [[Attach:hw11.zip|Files]] - [[ https://youtu.be/ezuRn1ViIJE|Solutions (1-5)]], [[https://youtu.be/8SNaW1nt6j0|Solution 6]]
*[[Attach:hw12.pdf|Assignment #12]] - [[Attach:hw12.zip|Files]] - [[https://youtu.be/oCr2eUIYznc|Solutions]]
*[[Attach:hw13.pdf|Assignment #13]] - [[Attach:hw13.zip|Files]] - [[https://youtu.be/ntyGGOiOD9w|Solutions 1]] - [[https://youtu.be/mV9HECu07z8|Solutions 2]]
*[[Attach:hw14.pdf|Assignment #14]] - [[Attach:hw14.zip|Files]] - [[ https://youtu.be/v4R6K4RxADE|Solutions 1-2]], [[https://youtu.be/66hOMWZec10|Solution 3]], [[https://youtu.be/Y7YBPqGKr9Y|Solution 4]]
*[[Attach:hw15.pdf|Assignment #15]] - [[Attach:hw15.zip|Files]] - [[https://youtu.be/4grhQ5Y_MWo|Solution 1]], [[https://youtu.be/Lj_-7xIGkeI|Solutions 2-4]]
*[[Attach:hw16.pdf|Assignment #16]] - [[Attach:hw16.zip|Files]] - [[https://youtu.be/BRe7qKIAa34|Solution]]
*[[Attach:hw17.pdf|Assignment #17]] - [[Attach:hw17.zip|Files]] - [[https://youtu.be/EaYEQ30KlWw|Solution]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]]
*[[Attach:hw10.pdf|Assignment #10]]
*
*
*
*[[Attach:
*
to:
*[[Attach:hw8.pdf|Assignment #8]] - [[Attach:hw8.zip|Files]]
** Loops and Arrays
** [[https://youtu.be/2Y6aMjBYPww|Solutions]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]]
** Plot Data and Correlations
** Solution [[https://youtu.be/ziRNzO1T-Mo|1]], [[https://youtu.be/Ql8QPcp8818|2]], [[https://youtu.be/6r5JZjokp-0|3]], [[https://youtu.be/G0ceVjin_cg|4]]
*[[Attach:hw10.pdf|Assignment #10]]
** User input, loops, ODEs, and plotting
** [[https://youtu.be/ouyg_TQGI2Q|Solution 2 (Video)]] - [[Attach:hw10.zip|Solution 2 (.py)]] - [[https://youtu.be/ygoohjN_Lww|Solution 3]]
*[[Attach:hw11.pdf|Assignment #11]] - [[Attach:hw11.zip|Files]]
** Debugging
** [[ https://youtu.be/ezuRn1ViIJE|Solutions (1-5)]], [[https://youtu.be/8SNaW1nt6j0|Solution 6]]
*[[Attach:hw12.pdf|Assignment #12]] - [[Attach:hw12.zip|Files]]
** File Input and Ouput
** [[https://youtu.be/oCr2eUIYznc|Solutions]]
*[[Attach:hw13.pdf|Assignment #13]] - [[Attach:hw13.zip|Files]]
** Classes (collections of values and functions)
** [[https://youtu.be/ntyGGOiOD9w|Solutions 1]] - [[https://youtu.be/mV9HECu07z8|Solutions 2]]
*[[Attach:hw14.pdf|Assignment #14]] - [[Attach:hw14.zip|Files]]
** Solve Equations (fsolve)
** [[ https://youtu.be/v4R6K4RxADE|Solutions 1-2]], [[https://youtu.be/66hOMWZec10|Solution 3]], [[https://youtu.be/Y7YBPqGKr9Y|Solution 4]]
*[[Attach:hw15.pdf|Assignment #15]] - [[Attach:hw15.zip|Files]]
** Integration, interpolation, and regression
** [[https://youtu.be/4grhQ5Y_MWo|Solution 1]], [[https://youtu.be/Lj_-7xIGkeI|Solutions 2-4]]
*[[Attach:hw16.pdf|Assignment #16]] - [[Attach:hw16.zip|Files]]
** Solve differential equations (odeint)
** [[https://youtu.be/BRe7qKIAa34|Solution]]
*[[Attach:hw17.pdf|Assignment #17]] - [[Attach:hw17.zip|Files]]
** Symbolic solutions (sympy)
** [[https://youtu.be/EaYEQ30KlWw|Solution]]
** Loops and Arrays
** [[https://youtu.be/2Y6aMjBYPww|Solutions]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]]
** Plot Data and Correlations
** Solution [[https://youtu.be/ziRNzO1T-Mo|1]], [[https://youtu.be/Ql8QPcp8818|2]], [[https://youtu.be/6r5JZjokp-0|3]], [[https://youtu.be/G0ceVjin_cg|4]]
*[[Attach:hw10.pdf|Assignment #10]]
** User input, loops, ODEs, and plotting
** [[https://youtu.be/ouyg_TQGI2Q|Solution 2 (Video)]] - [[Attach:hw10.zip|Solution 2 (.py)]] - [[https://youtu.be/ygoohjN_Lww|Solution 3]]
*[[Attach:hw11.pdf|Assignment #11]] - [[Attach:hw11.zip|Files]]
** Debugging
** [[ https://youtu.be/ezuRn1ViIJE|Solutions (1-5)]], [[https://youtu.be/8SNaW1nt6j0|Solution 6]]
*[[Attach:hw12.pdf|Assignment #12]] - [[Attach:hw12.zip|Files]]
** File Input and Ouput
** [[https://youtu.be/oCr2eUIYznc|Solutions]]
*[[Attach:hw13.pdf|Assignment #13]] - [[Attach:hw13.zip|Files]]
** Classes (collections of values and functions)
** [[https://youtu.be/ntyGGOiOD9w|Solutions 1]] - [[https://youtu.be/mV9HECu07z8|Solutions 2]]
*[[Attach:hw14.pdf|Assignment #14]] - [[Attach:hw14.zip|Files]]
** Solve Equations (fsolve)
** [[ https://youtu.be/v4R6K4RxADE|Solutions 1-2]], [[https://youtu.be/66hOMWZec10|Solution 3]], [[https://youtu.be/Y7YBPqGKr9Y|Solution 4]]
*[[Attach:hw15.pdf|Assignment #15]] - [[Attach:hw15.zip|Files]]
** Integration, interpolation, and regression
** [[https://youtu.be/4grhQ5Y_MWo|Solution 1]], [[https://youtu.be/Lj_-7xIGkeI|Solutions 2-4]]
*[[Attach:hw16.pdf|Assignment #16]] - [[Attach:hw16.zip|Files]]
** Solve differential equations (odeint)
** [[https://youtu.be/BRe7qKIAa34|Solution]]
*[[Attach:hw17.pdf|Assignment #17]] - [[Attach:hw17.zip|Files]]
** Symbolic solutions (sympy)
** [[https://youtu.be/EaYEQ30KlWw|Solution]]
Changed lines 21-23 from:
*[[Attach:hw7.pdf|Assignment #7]] - [[Attach:hw7.zip|Files]] - Solution [[https://youtu.be/r7C2Hu1Qtgg|1]], [[https://youtu.be/YugOojaknDM|2]], [[https://youtu.be/L7scElJU36s|3]], [[https://youtu.be/p2Dyx9DyQWw|4]]
to:
*[[Attach:hw7.pdf|Assignment #7]] - [[Attach:hw7.zip|Files]]
** Conditionals, Functions, Loops
** Solution [[https://youtu.be/r7C2Hu1Qtgg|1]], [[https://youtu.be/YugOojaknDM|2]], [[https://youtu.be/L7scElJU36s|3]], [[https://youtu.be/p2Dyx9DyQWw|4]]
** Conditionals, Functions, Loops
** Solution [[https://youtu.be/r7C2Hu1Qtgg|1]], [[https://youtu.be/YugOojaknDM|2]], [[https://youtu.be/L7scElJU36s|3]], [[https://youtu.be/p2Dyx9DyQWw|4]]
Changed line 15 from:
*[[Attach:hw5.pdf|Assignment #5]] - [[https://youtu.be/cc8CuFTX5CI|Solution 1]]
to:
*[[Attach:hw5.pdf|Assignment #5]] - [[https://youtu.be/cc8CuFTX5CI|Solution 1]], [[https://youtu.be/ySrMlC-bnGM|Solution 2]]
Changed line 11 from:
*[[Attach:hw3.pdf|Assignment #3]] - [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]], [[https://youtu.be/GMC31hEhFMg|Solution 3]]
to:
*[[Attach:hw3.pdf|Assignment #3]] - [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]], [[https://youtu.be/GMC31hEhFMg|Solution 3]], [[https://youtu.be/7HDO0ORwjn0|Solution 4]]
Changed line 17 from:
*[[Attach:hw6.pdf|Assignment #6]] - [[https://youtu.be/0C6QMin5OZc|Solution 2]]
to:
*[[Attach:hw6.pdf|Assignment #6]] - [[https://youtu.be/bHwFTDp5g6A|Solution 1]], [[https://youtu.be/0C6QMin5OZc|Solution 2]]
Changed line 17 from:
*[[Attach:hw6.pdf|Assignment #6]]
to:
*[[Attach:hw6.pdf|Assignment #6]] - [[https://youtu.be/0C6QMin5OZc|Solution 2]]
Changed line 15 from:
*[[Attach:hw5.pdf|Assignment #5]]
to:
*[[Attach:hw5.pdf|Assignment #5]] - [[https://youtu.be/cc8CuFTX5CI|Solution 1]]
Changed line 15 from:
*[[Attach:hw5a.pdf|Assignment #5]]
to:
*[[Attach:hw5.pdf|Assignment #5]]
Changed line 13 from:
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]] - [[https://youtu.be/eXco8_3MmjI|Solution 2]],[[https://youtu.be/kehsHfFMsAE|Solution 3]]
to:
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]] - [[https://youtu.be/eXco8_3MmjI|Solution 2]], [[https://youtu.be/kehsHfFMsAE|Solution 3]]
Changed line 13 from:
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]] - [[https://youtu.be/kehsHfFMsAE|Solution 3]]
to:
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]] - [[https://youtu.be/eXco8_3MmjI|Solution 2]],[[https://youtu.be/kehsHfFMsAE|Solution 3]]
Changed line 13 from:
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]]
to:
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]] - [[https://youtu.be/kehsHfFMsAE|Solution 3]]
Changed line 11 from:
*[[Attach:hw3.pdf|Assignment #3]] - [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]]
to:
*[[Attach:hw3.pdf|Assignment #3]] - [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]], [[https://youtu.be/GMC31hEhFMg|Solution 3]]
Changed line 7 from:
*[[Attach:hw1.pdf|Assignment #1]] - [[https://youtu.be/VPjoNrtm8wk|Solution 2]] - [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
to:
*[[Attach:hw1.pdf|Assignment #1]] - [[https://youtu.be/VPjoNrtm8wk|Solution 2]], [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
Changed line 11 from:
*[[Attach:hw3.pdf|Assignment #3]] - [[https://youtu.be/wbDfPIpTf4E|Solution 1]]
to:
*[[Attach:hw3.pdf|Assignment #3]] - [[https://youtu.be/wbDfPIpTf4E|Solution 1]], [[https://youtu.be/td9AQZF5gIM|Solution 2]]
Changed line 11 from:
*[[Attach:hw3.pdf|Assignment #3]]
to:
*[[Attach:hw3.pdf|Assignment #3]] - [[https://youtu.be/wbDfPIpTf4E|Solution 1]]
Changed line 9 from:
*[[Attach:hw2.pdf|Assignment #2]] - [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|Solution 2]], [[https://youtu.be/Waz-NcSMLe4|Solution 3]]
to:
*[[Attach:hw2.pdf|Assignment #2]] - [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|Solution 2]], [[https://youtu.be/AJwxW6oMu_E|Solution 3]]
Changed line 9 from:
*[[Attach:hw2.pdf|Assignment #2]] - [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|2]], [[https://youtu.be/Waz-NcSMLe4|3]]
to:
*[[Attach:hw2.pdf|Assignment #2]] - [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|Solution 2]], [[https://youtu.be/Waz-NcSMLe4|Solution 3]]
Changed line 9 from:
*[[Attach:hw2.pdf|Assignment #2]] - [[https://youtu.be/CchyR-vmFbk|Solution 1]]
to:
*[[Attach:hw2.pdf|Assignment #2]] - [[https://youtu.be/CchyR-vmFbk|Solution 1]], [[https://youtu.be/Waz-NcSMLe4|2]], [[https://youtu.be/Waz-NcSMLe4|3]]
Changed line 9 from:
*[[Attach:hw2.pdf|Assignment #2]]
to:
*[[Attach:hw2.pdf|Assignment #2]] - [[https://youtu.be/CchyR-vmFbk|Solution 1]]
Changed line 7 from:
*[[Attach:hw1.pdf|Assignment #1]] - [[https://youtu.be/VPjoNrtm8wk|Solution 2]] - [[https://youtu.be/VPjoNrtm8wk|Solution 3]]
to:
*[[Attach:hw1.pdf|Assignment #1]] - [[https://youtu.be/VPjoNrtm8wk|Solution 2]] - [[https://youtu.be/JF7Lda8_YzE|Solution 3]]
Changed line 7 from:
*[[Attach:hw1.pdf|Assignment #1]]
to:
*[[Attach:hw1.pdf|Assignment #1]] - [[https://youtu.be/VPjoNrtm8wk|Solution 2]] - [[https://youtu.be/VPjoNrtm8wk|Solution 3]]
Changed lines 21-42 from:
*[[Attach:hw7.pdf|Assignment #7]] - [[Attach:hw7.zip|Files]]
*[[Attach:hw8.pdf|Assignment #8]] - [[Attach:hw8.zip|Files]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]]
*[[Attach:hw10.pdf|Assignment #10]]
*[[Attach:hw11.pdf|Assignment #11]] - [[Attach:hw11.zip|Files]]
*[[Attach:hw12.pdf|Assignment #12]] - [[Attach:hw12.zip|Files]]
*[[Attach:hw13.pdf|Assignment #13]] - [[Attach:hw13.zip|Files]]
*[[Attach:hw14.pdf|Assignment #14]] - [[Attach:hw14.zip|Files]]
*[[Attach:hw15.pdf|Assignment #15]] - [[Attach:hw15.zip|Files]]
*[[Attach:hw16.pdf|Assignment #16]] - [[Attach:hw16.zip|Files]]
*[[Attach:hw17.pdf|Assignment #17]] - [[Attach:hw17.zip|Files]]
*
*
*[[Attach:
*
*[[Attach:
*
*
*[[Attach:
*
*[[Attach:
to:
*[[Attach:hw7.pdf|Assignment #7]] - [[Attach:hw7.zip|Files]] - Solution [[https://youtu.be/r7C2Hu1Qtgg|1]], [[https://youtu.be/YugOojaknDM|2]], [[https://youtu.be/L7scElJU36s|3]], [[https://youtu.be/p2Dyx9DyQWw|4]]
*[[Attach:hw8.pdf|Assignment #8]] - [[Attach:hw8.zip|Files]] - [[https://youtu.be/2Y6aMjBYPww|Solutions]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]] - Solution [[https://youtu.be/ziRNzO1T-Mo|1]], [[https://youtu.be/Ql8QPcp8818|2]], [[https://youtu.be/6r5JZjokp-0|3]], [[https://youtu.be/G0ceVjin_cg|4]]
*[[Attach:hw10.pdf|Assignment #10]] - [[https://youtu.be/ouyg_TQGI2Q|Solution 2 (Video)]] - [[Attach:hw10.zip|Solution 2 (.py)]] - [[https://youtu.be/ygoohjN_Lww|Solution 3]]
*[[Attach:hw11.pdf|Assignment #11]] - [[Attach:hw11.zip|Files]] - [[ https://youtu.be/ezuRn1ViIJE|Solutions (1-5)]], [[https://youtu.be/8SNaW1nt6j0|Solution 6]]
*[[Attach:hw12.pdf|Assignment #12]] - [[Attach:hw12.zip|Files]] - [[https://youtu.be/oCr2eUIYznc|Solutions]]
*[[Attach:hw13.pdf|Assignment #13]] - [[Attach:hw13.zip|Files]] - [[https://youtu.be/ntyGGOiOD9w|Solutions 1]] - [[https://youtu.be/mV9HECu07z8|Solutions 2]]
*[[Attach:hw14.pdf|Assignment #14]] - [[Attach:hw14.zip|Files]] - [[ https://youtu.be/v4R6K4RxADE|Solutions 1-2]], [[https://youtu.be/66hOMWZec10|Solution 3]], [[https://youtu.be/Y7YBPqGKr9Y|Solution 4]]
*[[Attach:hw15.pdf|Assignment #15]] - [[Attach:hw15.zip|Files]] - [[https://youtu.be/4grhQ5Y_MWo|Solution 1]], [[https://youtu.be/Lj_-7xIGkeI|Solutions 2-4]]
*[[Attach:hw16.pdf|Assignment #16]] - [[Attach:hw16.zip|Files]] - [[https://youtu.be/BRe7qKIAa34|Solution]]
*[[Attach:hw17.pdf|Assignment #17]] - [[Attach:hw17.zip|Files]] - [[https://youtu.be/EaYEQ30KlWw|Solution]]
*[[Attach:hw8.pdf|Assignment #8]] - [[Attach:hw8.zip|Files]] - [[https://youtu.be/2Y6aMjBYPww|Solutions]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]] - Solution [[https://youtu.be/ziRNzO1T-Mo|1]], [[https://youtu.be/Ql8QPcp8818|2]], [[https://youtu.be/6r5JZjokp-0|3]], [[https://youtu.be/G0ceVjin_cg|4]]
*[[Attach:hw10.pdf|Assignment #10]] - [[https://youtu.be/ouyg_TQGI2Q|Solution 2 (Video)]] - [[Attach:hw10.zip|Solution 2 (.py)]] - [[https://youtu.be/ygoohjN_Lww|Solution 3]]
*[[Attach:hw11.pdf|Assignment #11]] - [[Attach:hw11.zip|Files]] - [[ https://youtu.be/ezuRn1ViIJE|Solutions (1-5)]], [[https://youtu.be/8SNaW1nt6j0|Solution 6]]
*[[Attach:hw12.pdf|Assignment #12]] - [[Attach:hw12.zip|Files]] - [[https://youtu.be/oCr2eUIYznc|Solutions]]
*[[Attach:hw13.pdf|Assignment #13]] - [[Attach:hw13.zip|Files]] - [[https://youtu.be/ntyGGOiOD9w|Solutions 1]] - [[https://youtu.be/mV9HECu07z8|Solutions 2]]
*[[Attach:hw14.pdf|Assignment #14]] - [[Attach:hw14.zip|Files]] - [[ https://youtu.be/v4R6K4RxADE|Solutions 1-2]], [[https://youtu.be/66hOMWZec10|Solution 3]], [[https://youtu.be/Y7YBPqGKr9Y|Solution 4]]
*[[Attach:hw15.pdf|Assignment #15]] - [[Attach:hw15.zip|Files]] - [[https://youtu.be/4grhQ5Y_MWo|Solution 1]], [[https://youtu.be/Lj_-7xIGkeI|Solutions 2-4]]
*[[Attach:hw16.pdf|Assignment #16]] - [[Attach:hw16.zip|Files]] - [[https://youtu.be/BRe7qKIAa34|Solution]]
*[[Attach:hw17.pdf|Assignment #17]] - [[Attach:hw17.zip|Files]] - [[https://youtu.be/EaYEQ30KlWw|Solution]]
Changed lines 46-47 from:
to:
** [[https://youtu.be/UV7aU7HXv7E | Solutions]]
Changed lines 50-51 from:
to:
** [[https://youtu.be/Gpzv0GfZ0LM|Solutions]]
Changed lines 53-55 from:
to:
** [[https://youtu.be/XOxK4aKvLk0 | Solutions 1-6]]
** [[https://youtu.be/O4_lYRMawXo | Solutions 7-9]]
** [[https://youtu.be/O4_lYRMawXo | Solutions 7-9]]
Deleted line 57:
Added lines 1-54:
(:title Programming Assignments:)
(:keywords homework, nonlinear, optimization, engineering optimization, Excel, Mathcad, Visual Basic, MATLAB, differential, algebraic, modeling language, university course:)
(:description Assignments for Problem-Solving Techniques for Chemical Engineers at Brigham Young University:)
!!!!Excel Assignments
*[[Attach:hw1.pdf|Assignment #1]]
*[[Attach:hw2.pdf|Assignment #2]]
*[[Attach:hw3.pdf|Assignment #3]]
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]]
*[[Attach:hw5a.pdf|Assignment #5]]
*[[Attach:hw6.pdf|Assignment #6]]
!!!!Python Assignments
*[[Attach:hw7.pdf|Assignment #7]] - [[Attach:hw7.zip|Files]]
*[[Attach:hw8.pdf|Assignment #8]] - [[Attach:hw8.zip|Files]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]]
*[[Attach:hw10.pdf|Assignment #10]]
*[[Attach:hw11.pdf|Assignment #11]] - [[Attach:hw11.zip|Files]]
*[[Attach:hw12.pdf|Assignment #12]] - [[Attach:hw12.zip|Files]]
*[[Attach:hw13.pdf|Assignment #13]] - [[Attach:hw13.zip|Files]]
*[[Attach:hw14.pdf|Assignment #14]] - [[Attach:hw14.zip|Files]]
*[[Attach:hw15.pdf|Assignment #15]] - [[Attach:hw15.zip|Files]]
*[[Attach:hw16.pdf|Assignment #16]] - [[Attach:hw16.zip|Files]]
*[[Attach:hw17.pdf|Assignment #17]] - [[Attach:hw17.zip|Files]]
!!!!MathCAD Assignments
*[[Attach:hw_mathcad_basics.pdf|Assignment #18 - Variables and Equations]]
*[[Attach:hw_mathcad_arrays_functions.pdf|Assignment #19 - Functions, Arrays, and Logical Conditions]]
** [[Attach:hw9_array.zip|Download array.txt for import]]
*[[Attach:hw_mathcad_symbolics_plotting_solve.pdf|Assignment #20 - Symbolic Manipulation, Plots, and Solve Blocks]]
*[[Attach:hw_mathcad_curvefit_solve.pdf|Assignment #21 - Curve Fitting, Advanced Plots, and More on Solve Blocks]]
** [[Attach:hw11_supplemental_file.zip|Assignment #21 - Supplemental Files]]
(:keywords homework, nonlinear, optimization, engineering optimization, Excel, Mathcad, Visual Basic, MATLAB, differential, algebraic, modeling language, university course:)
(:description Assignments for Problem-Solving Techniques for Chemical Engineers at Brigham Young University:)
!!!!Excel Assignments
*[[Attach:hw1.pdf|Assignment #1]]
*[[Attach:hw2.pdf|Assignment #2]]
*[[Attach:hw3.pdf|Assignment #3]]
*[[Attach:hw4.pdf|Assignment #4]] - [[Attach:hw4.zip|Files]]
*[[Attach:hw5a.pdf|Assignment #5]]
*[[Attach:hw6.pdf|Assignment #6]]
!!!!Python Assignments
*[[Attach:hw7.pdf|Assignment #7]] - [[Attach:hw7.zip|Files]]
*[[Attach:hw8.pdf|Assignment #8]] - [[Attach:hw8.zip|Files]]
*[[Attach:hw9.pdf|Assignment #9]] - [[Attach:hw9.zip|Files]]
*[[Attach:hw10.pdf|Assignment #10]]
*[[Attach:hw11.pdf|Assignment #11]] - [[Attach:hw11.zip|Files]]
*[[Attach:hw12.pdf|Assignment #12]] - [[Attach:hw12.zip|Files]]
*[[Attach:hw13.pdf|Assignment #13]] - [[Attach:hw13.zip|Files]]
*[[Attach:hw14.pdf|Assignment #14]] - [[Attach:hw14.zip|Files]]
*[[Attach:hw15.pdf|Assignment #15]] - [[Attach:hw15.zip|Files]]
*[[Attach:hw16.pdf|Assignment #16]] - [[Attach:hw16.zip|Files]]
*[[Attach:hw17.pdf|Assignment #17]] - [[Attach:hw17.zip|Files]]
!!!!MathCAD Assignments
*[[Attach:hw_mathcad_basics.pdf|Assignment #18 - Variables and Equations]]
*[[Attach:hw_mathcad_arrays_functions.pdf|Assignment #19 - Functions, Arrays, and Logical Conditions]]
** [[Attach:hw9_array.zip|Download array.txt for import]]
*[[Attach:hw_mathcad_symbolics_plotting_solve.pdf|Assignment #20 - Symbolic Manipulation, Plots, and Solve Blocks]]
*[[Attach:hw_mathcad_curvefit_solve.pdf|Assignment #21 - Curve Fitting, Advanced Plots, and More on Solve Blocks]]
** [[Attach:hw11_supplemental_file.zip|Assignment #21 - Supplemental Files]]