Skip to content

Commit

Permalink
finished project and notes
Browse files Browse the repository at this point in the history
  • Loading branch information
rcc02007 committed Jan 14, 2020
1 parent ecc40dc commit 11aa375
Show file tree
Hide file tree
Showing 7 changed files with 296 additions and 153 deletions.
142 changes: 0 additions & 142 deletions data/land_global_temperature_anomaly-1880-2016.csv

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Getting Started\n",
"\n"
"###### Content modified under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2020 R.C. Cooper"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Working with Python"
]
},
{
Expand Down Expand Up @@ -156,7 +162,7 @@
" factorial_function(input_number): calculates the factorial of the input_number\n",
" where the factorial is defined as N*(N-1)*(N-2)*...*3*2*1\n",
" \n",
" Arguments\n",
" Arguments\n",
" ---------\n",
" input_value: an integer >= 0\n",
" \n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/01_Interacting_with_Python.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"###### Content under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2017 L.A. Barba, N.C. Clementi"
"###### Content modified under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2020 R.C. Cooper"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Getting Started\n",
"\n"
"###### Content modified under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2020 R.C. Cooper"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Working with Python"
]
},
{
Expand Down Expand Up @@ -156,7 +162,7 @@
" factorial_function(input_number): calculates the factorial of the input_number\n",
" where the factorial is defined as N*(N-1)*(N-2)*...*3*2*1\n",
" \n",
" Arguments\n",
" Arguments\n",
" ---------\n",
" input_value: an integer >= 0\n",
" \n",
Expand Down
29 changes: 25 additions & 4 deletions notebooks/03-Numerical_error.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"###### Content modified under Creative Commons Attribution license CC-BY 4.0, code under BSD 3-Clause License © 2020 R.C. Cooper"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand All @@ -8,8 +15,8 @@
}
},
"source": [
"# Freefall Model\n",
"## Computational solution\n",
"# Numerical Error\n",
"## Freefall Model Computational solution\n",
"\n",
"<img src=\"../images/freefall.png\" style=\"width: 200px;\"/> \n",
"\n",
Expand Down Expand Up @@ -1033,7 +1040,7 @@
},
{
"cell_type": "code",
"execution_count": 301,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand All @@ -1054,6 +1061,13 @@
"print(data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -1073,7 +1087,7 @@
},
{
"cell_type": "code",
"execution_count": 273,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -1092,6 +1106,13 @@
" return ex\n",
" "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
112 changes: 112 additions & 0 deletions project/.ipynb_checkpoints/01_Getting-started-project-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Computational Mechanics Project #01 - Heat Transfer in Forensic Science\n",
"\n",
"We can use our current skillset for a macabre application. We can predict the time of death based upon the current temperature of a corpse. \n",
"\n",
"Forensic scientists use Newton's law of cooling to determine the time elapsed since the loss of life, \n",
"\n",
"$\\frac{dT}{dt} = -K(T-T_a)$,\n",
"\n",
"where $T$ is the current temperature, $T_a$ is the ambient temperature, $t$ is the elapsed time in hours, and $K$ is an empirical constant. \n",
"\n",
"Suppose the temperature of the corpse is 85$^o$F at 11:00 am. Then, 2 hours later the temperature is 74$^{o}$F. \n",
"\n",
"Assume ambient temperature is a constant 65$^{o}$F.\n",
"\n",
"1. Use Python to calculate $K$ using a finite difference approximation, $\\frac{dT}{dt} \\approx \\frac{T(t+\\Delta t)-T(t)}{\\Delta t}$. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"2. Change your work from problem 1 to create a function that accepts the temperature at two times, ambient temperature, and the time elapsed to return $K$. "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def measure_K(Temp_t1,Temp_t2,Temp_ambient,delta_t):\n",
" ''' Determine the value of K based upon temperature of corpse \n",
" when discovered, Temp_t1\n",
" after time, delta_t, Temp_t2\n",
" with ambient temperature, Temp_ambient\n",
" Arguments\n",
" ---------\n",
" your inputs...\n",
" \n",
" Returns\n",
" -------\n",
" your outputs...\n",
" \n",
" '''\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"3. A first-order thermal system has the following analytical solution, \n",
"\n",
" $T(t) =T_a+(T(0)-T_a)e^{-Kt}$\n",
"\n",
" where $T(0)$ is the temperature of the corpse at t=0 hours i.e. at the time of discovery and $T_a$ is a constant ambient temperature. \n",
"\n",
" a. Show that an Euler integration converges to the analytical solution as the time step is decreased. Use the constant $K$ derived above and the initial temperature, T(0) = 85$^o$F. \n",
"\n",
" b. What is the final temperature as t$\\rightarrow\\infty$?\n",
" \n",
" c. At what time was the corpse 98.6$^{o}$F? i.e. what was the time of death?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"4. Now that we have a working numerical model, we can look at the results if the ambient temperature is not constant i.e. T_a=f(t). ss"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit 11aa375

Please sign in to comment.