Skip to content

rcc02007/CompMech01-Getting-started

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

Computational Mechanics 01 - Getting Started

Working with Python and Numerical Methods

Welcome to Computational Mechanics Module #1 - Getting Started!

There are three modules and one final project. The modules will get us started on our exploration of computational mechanics using Python, listed below each module are the learning objectives.

  1. 01_Interacting_with_Python
  • Using the print() function. The concept of function.
  • Using Python as a calculator.
  • Concepts of variable, type, assignment.
  • Special variables: True, False, None.
  • Supported operations, logical operations.
  • Reading error messages.
  1. 02_Working_with_Python
  • Good coding habits and file naming
  • How to define a function and return outputs
  • How to import libraries
  • Multidimensional arrays using NumPy
  • Accessing values and slicing in NumPy arrays
  • %%time magic to time cell execution.
  • Performance comparison: lists vs NumPy arrays
  • Basic plotting with pyplot.
  1. 03-Numerical_error
  • Numerical integration with the Euler approximation
  • The source of truncation errors
  • The source of roundoff errors
  • How to time a numerical solution or a function
  • How to compare solutions
  • The definition of absolute error and relative error
  • How a numerical solution converges

We can use our current skillset for a macabre application. We can predict the time of death based upon the current temperature and change in temperature of a corpse.

Forensic scientists use Newton's law of cooling to determine the time elapsed since the loss of life,

$\frac{dT}{dt} = -K(T-T_a)$,

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.

Suppose the temperature of the corpse is 85$^o$F at 11:00 am. Then, 2 hours later the temperature is 74$^{o}$F.

Assume ambient temperature is a constant 65$^{o}$F.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published