Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

HW12: More Solving of Ordinary Differential Equations (ODEs)

Problem 1: Solve the following differential equation using odeint

If you are living on the International Space Station and accidentally get ejected into space without a space suit, you would need to get air within a few minutes to prevent death. Even if you have air, if you aren’t kept warm, your body would be hypothermic in a relatively short period. Let find out how long you have to get back to the space station before becoming hypothermic. There are likely other more deadly conditions of being exposed to a vacuum than running out of oxygen or freezing, but we will ignore those for now.

Assuming your are on the shadowed side of Earth, the following is a simple model that describes how your body’s average temperature TT could change in time. The term on the left is the accumulation term; the first term on the right is a generation term (from your metabolism); the second term on the right is emission by radiation into space (space does not return any radiation to you).

mcpdTdt=Q˙−σAT4m c_p\frac{dT}{dt} = \dot{Q}- \sigma A T^4

where mm is total body mass, cpc_p is heat capacity, Q˙\dot{Q} is heat generation by your body, AA is effective surface area of your body that emits radiation, and σ\sigma is the Stefan-Boltzmann radiation constant (look it up online).

Your code should be well-documented and all constants should be specified with units. You should use SI units generally in this problem, though will need to switch between K\mathrm{K} and ∘C^\circ\mathrm{C}. A couple notes on that: Temperature in the radiation term must be absolute (i.e. units K\mathrm{K}). Recall from ChEn 170 that for heat capacity the denominator contains a change in temperature (i.e. either ΔK\Delta\mathrm{K} or Δ∘C\Delta^\circ\mathrm{C} which are perfectly the same). Once you get an answer in K\mathrm{K} you will need to convert to ∘C^\circ\mathrm{C} in the final plot.

To solve this problem you need to do the following.

  1. Reasonably estimate the values of mm and AA for your body (or for ‘a friend’). The area that emits radiation could be estimated, for instance, by treating your body as if it were a cylinder of water.

  2. Assume cpc_p for your body is the value for water

  3. Reasonably estimate what your Q˙\dot{Q} would be in this scenario: a person while resting generates about 100 W100~\mathrm{W} heat and while vigorously exercising generates around 300 W300~\mathrm{W}.

  4. Rearrange the above equation and determine what is needed to implement into odeint

  5. Make a smooth well-formatted plot of body temperature (∘C^\circ\mathrm{C}) over time (s\mathrm{s}). Adjust the timescale so that the plot readily shows the most relevant region of interest.

  6. Based on the plot of the model result, estimate the time when you would get to hypothermia. Normal body temperature is 37∘C37^\circ\mathrm{C}; hypothermia begins at 35∘C35^\circ\mathrm{C}.

Problem 2: Use ODEINT

Use ODEINT to solve the Lorenz Equations given in the class module. The class module used a loop and Euler’s method to solve the equations. You should be able to use ODEINT to solve the equations. Use the same parameters for your solution: sigma=10; rho=28; beta=8/3; initial conditions: x=10, y=10, z=10.

Plot the x, y, and z variables over time as is done in the class module on a 3D plot. Does your solution match the class module solution?

Problem 3: More ODE Practice

Use any method to solve the last differential equation in the class module and compare your results with the data for the CO2 concentration versus time. The equation is given by:

dCCO2dt=k1−k2CCO20.5\frac{dC_{CO_2}}{dt} = k_1 - k_2C_{CO_2}^{0.5}

Use the following parameters: k1=220k_1=220 and k2=1.7k_2=1.7. The initial condition is df[‘CO₂’].iloc[-594]. The iloc is a location point (row) in the data frame. Plot rows -594 to -550 as is done in the class module. How could you optimize the parameters to better fit the data?