Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168734
Image: ubuntu2004
## This file investigates the steady-state reached for a cell culture growing in a CSTR (aka a 'chemostat'). ## It displays the steady-state analytical solution and graphs the functional dependence var('mu Y K_m mu_max X_in S_in V_in V_out X_0 S_0') (X,S,t) = var('X,S,t') ## For steady-state, V_in = Vout == V var('V') V_in = V V_out = V ## Define mu mu = (mu_max*S)/(K_m+S) ## Solve for the steady-state cell and substrate density as f(process variables) dXdt = mu*X+X_in*V_in-X*V_out==0 dSdt = (-1/Y)*mu*X+S_in*V_in-S*V_out==0 ss = solve([dXdt,dSdt],X,S) ## Parse out the equations for X and S from the solution matrix X_ss(mu_max,K_m,Y,X_in,S_in,V) = ss[0][0].rhs() S_ss(mu_max,K_m,Y,X_in,S_in,V) = ss[0][1].rhs() ## Show the analytical expressions for S and X at steady-state show(ss[0][0]) show(ss[0][1])
X=((Km+Sin)VSinμmax)Y+2VXinXinμmaxXin2μmax2+(Sin2μmax2+(Km2+2KmSin+Sin2)V22(KmSinμmax+Sin2μmax)V)Y2+2(SinXinμmax2+(KmμmaxSinμmax)VXin)Y2(Vμmax)\renewcommand{\Bold}[1]{\mathbf{#1}}X = \frac{{\left({\left(K_{m} + S_{\mbox{in}}\right)} V - S_{\mbox{in}} \mu_{\mbox{max}}\right)} Y + 2 \, V X_{\mbox{in}} - X_{\mbox{in}} \mu_{\mbox{max}} - \sqrt{X_{\mbox{in}}^{2} \mu_{\mbox{max}}^{2} + {\left(S_{\mbox{in}}^{2} \mu_{\mbox{max}}^{2} + {\left(K_{m}^{2} + 2 \, K_{m} S_{\mbox{in}} + S_{\mbox{in}}^{2}\right)} V^{2} - 2 \, {\left(K_{m} S_{\mbox{in}} \mu_{\mbox{max}} + S_{\mbox{in}}^{2} \mu_{\mbox{max}}\right)} V\right)} Y^{2} + 2 \, {\left(S_{\mbox{in}} X_{\mbox{in}} \mu_{\mbox{max}}^{2} + {\left(K_{m} \mu_{\mbox{max}} - S_{\mbox{in}} \mu_{\mbox{max}}\right)} V X_{\mbox{in}}\right)} Y}}{2 \, {\left(V - \mu_{\mbox{max}}\right)}}
<html><script type="math/tex; mode=display">\newcommand{\Bold}[1]{\mathbf{#1}}S = -\frac{{\left(K_{m} X_{\mbox{in}} \mu_{\mbox{max}} - \sqrt{K_{m}^{2} V^{2} Y^{2} + 2 \, K_{m} S_{\mbox{in}} V^{2} Y^{2} - 2 \, K_{m} S_{\mbox{in}} V Y^{2} \mu_{\mbox{max}} + S_{\mbox{in}}^{2} V^{2} Y^{2} - 2 \, S_{\mbox{in}}^{2} V Y^{2} \mu_{\mbox{max}} + S_{\mbox{in}}^{2} Y^{2} \mu_{\mbox{max}}^{2} + 2 \, K_{m} V X_{\mbox{in}} Y \mu_{\mbox{max}} - 2 \, S_{\mbox{in}} V X_{\mbox{in}} Y \mu_{\mbox{max}} + 2 \, S_{\mbox{in}} X_{\mbox{in}} Y \mu_{\mbox{max}}^{2} + X_{\mbox{in}}^{2} \mu_{\mbox{max}}^{2}} K_{m}\right)} V - {\left(K_{m} S_{\mbox{in}} V \mu_{\mbox{max}} - {\left(K_{m}^{2} + K_{m} S_{\mbox{in}}\right)} V^{2}\right)} Y}{X_{\mbox{in}} \mu_{\mbox{max}}^{2} - {\left(X_{\mbox{in}} \mu_{\mbox{max}} + \sqrt{K_{m}^{2} V^{2} Y^{2} + 2 \, K_{m} S_{\mbox{in}} V^{2} Y^{2} - 2 \, K_{m} S_{\mbox{in}} V Y^{2} \mu_{\mbox{max}} + S_{\mbox{in}}^{2} V^{2} Y^{2} - 2 \, S_{\mbox{in}}^{2} V Y^{2} \mu_{\mbox{max}} + S_{\mbox{in}}^{2} Y^{2} \mu_{\mbox{max}}^{2} + 2 \, K_{m} V X_{\mbox{in}} Y \mu_{\mbox{max}} - 2 \, S_{\mbox{in}} V X_{\mbox{in}} Y \mu_{\mbox{max}} + 2 \, S_{\mbox{in}} X_{\mbox{in}} Y \mu_{\mbox{max}}^{2} + X_{\mbox{in}}^{2} \mu_{\mbox{max}}^{2}}\right)} V + {\left({\left(K_{m} + S_{\mbox{in}}\right)} V^{2} + S_{\mbox{in}} \mu_{\mbox{max}}^{2} - {\left(K_{m} \mu_{\mbox{max}} + 2 \, S_{\mbox{in}} \mu_{\mbox{max}}\right)} V\right)} Y + \sqrt{K_{m}^{2} V^{2} Y^{2} + 2 \, K_{m} S_{\mbox{in}} V^{2} Y^{2} - 2 \, K_{m} S_{\mbox{in}} V Y^{2} \mu_{\mbox{max}} + S_{\mbox{in}}^{2} V^{2} Y^{2} - 2 \, S_{\mbox{in}}^{2} V Y^{2} \mu_{\mbox{max}} + S_{\mbox{in}}^{2} Y^{2} \mu_{\mbox{max}}^{2} + 2 \, K_{m} V X_{\mbox{in}} Y \mu_{\mbox{max}} - 2 \, S_{\mbox{in}} V X_{\mbox{in}} Y \mu_{\mbox{max}} + 2 \, S_{\mbox{in}} X_{\mbox{in}} Y \mu_{\mbox{max}}^{2} + X_{\mbox{in}}^{2} \mu_{\mbox{max}}^{2}} \mu_{\mbox{max
/script> }}}
################################################ #### Unnecessarily Fancy Plotting Stuff #### ################################################ ## Create a plot object a = plot([],figsize=[6,4]) ## Set the plot parameters title = "[cell], [substrate] as f(dilution rate)" xmin = 0 xmax = 0.08 ymin = 0 ymax = 10 ## Add a title to the plot a += text(title,(xmax/1.8,ymax),color='black',fontsize=15) ## Add the desired lines to the plot a += plot(X_ss(0.1,2,0.5,0,10),color='orange',legend_label='[cell]') a += plot(S_ss(0.1,2,0.5,0,10),color='purple',legend_label='[substrate]') ## For more information on plots in general, evaluate 'plot?' ## For a list of legend options, evaluate 'a.set_legend_options?' ## For a list of Sage predefined colors, evaluate 'sorted(colors)' a.set_axes_range(xmin,xmax,ymin,ymax) a.axes_labels(['dilution rate','concentration']) a.axes_label_color('grey') a.set_legend_options(ncol=2,borderaxespad=5,back_color='whitesmoke',fancybox=true) show(a)