Skip to content

Instantly share code, notes, and snippets.

@simonres
Created October 24, 2016 00:41
Show Gist options
  • Save simonres/a354a677f5e46b886812699237a94e8b to your computer and use it in GitHub Desktop.
Save simonres/a354a677f5e46b886812699237a94e8b to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In classical physics, where the speeds of source and the receiver relative to the medium are lower than the velocity of waves in the medium, the relationship between observed frequency $f$ and emitted frequency $f_\\text{0}$ is given by\n",
"\\begin{equation}\n",
"f = \\left( \\frac{c + v_\\text{r}}{c + v_\\text{s}} \\right) f_0 \\,\n",
"\\end{equation}\n",
"here\n",
"* $c \\;$ is the velocity of waves in the medium;\n",
"* $v_\\text{r} \\,$ is the velocity of the receiver relative to the medium; positive if the receiver is moving towards the source (and negative in the other direction);\n",
"* $v_\\text{s} \\,$ is the velocity of the source relative to the medium; positive if the source is moving away from the receiver (and negative in the other direction).\n",
"\n",
"The frequency is decreased if either is moving away from the other."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def f(c,vr,vs,f0):\n",
" return ((c + vr) / (c + vs)) * f0 "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"the ambulance is approaching you"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"743.3168316831684"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"c=343.2\n",
"vr=0\n",
"vs=-20\n",
"f0=700\n",
"f(c,vr,vs,f0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"the ambulance is driving away from you"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"661.453744493392"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"c=343.2\n",
"vr=0\n",
"vs=20\n",
"f0=700\n",
"f(c,vr,vs,f0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You are approaching the ambulance"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"740.7925407925408"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"c=343.2\n",
"vr=20\n",
"vs=0\n",
"f0=700\n",
"f(c,vr,vs,f0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You are running away from the police car"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"659.2074592074592"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"c=343.2\n",
"vr=-20\n",
"vs=0\n",
"f0=700\n",
"f(c,vr,vs,f0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If nothing is moving "
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"700.0"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"c=343.2\n",
"vr=0\n",
"vs=0\n",
"f0=700\n",
"f(c,vr,vs,f0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment