Skip to content
Permalink
d5ea9d970c
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?
Go to file
 
 
Cannot retrieve contributors at this time
594 lines (594 sloc) 37 KB
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Solution to Form #1"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ans = 14\r\n"
]
}
],
"source": [
"[1,2,3]*[1;2;3]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"[1,2,3]*[1;2;3]=?"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# The first source of error is roundoff error\n",
"## Just storing a number in a computer requires rounding"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"realmax = 1.79769313486231570815e+308\n",
"realmin = 2.22507385850720138309e-308\n",
"maximum relative error = 2.22044604925031308085e-16\n"
]
}
],
"source": [
"fprintf('realmax = %1.20e\\n',realmax)\n",
"fprintf('realmin = %1.20e\\n',realmin)\n",
"fprintf('maximum relative error = %1.20e\\n',eps)\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ans = 1\r\n"
]
}
],
"source": [
"s=1;\n",
"for i=1:1000\n",
" s=s+eps/10;\n",
"end\n",
"s==1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Freefall Model (revisited)\n",
"## Octave solution (will run same on Matlab)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Set default values in Octave for linewidth and text size"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%plot --format svg"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"set (0, \"defaultaxesfontname\", \"Helvetica\")\n",
"set (0, \"defaultaxesfontsize\", 18)\n",
"set (0, \"defaulttextfontname\", \"Helvetica\")\n",
"set (0, \"defaulttextfontsize\", 18) \n",
"set (0, \"defaultlinelinewidth\", 4)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Define time from 0 to 12 seconds with `N` timesteps \n",
"function defined as `freefall`"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"function [v_analytical,v_terminal,t]=freefall(N)\n",
" t=linspace(0,12,N)';\n",
" c=0.25; m=60; g=9.81; v_terminal=sqrt(m*g/c);\n",
"\n",
" v_analytical = v_terminal*tanh(g*t/v_terminal);\n",
" v_numerical=zeros(length(t),1);\n",
" delta_time =diff(t);\n",
" for i=1:length(t)-1\n",
" v_numerical(i+1)=v_numerical(i)+(g-c/m*v_numerical(i)^2)*delta_time(i);\n",
" end\n",
" % Print values near 0,2,4,6,8,10,12 seconds\n",
" indices = round(linspace(1,length(t),7));\n",
" fprintf('time (s)|vel analytical (m/s)|vel numerical (m/s)\\n')\n",
" fprintf('-----------------------------------------------\\n')\n",
" M=[t(indices),v_analytical(indices),v_numerical(indices)];\n",
" fprintf('%7.1f | %18.2f | %15.2f\\n',M(:,1:3)');\n",
" plot(t,v_analytical,'-',t,v_numerical,'o-')\n",
"end\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"time (s)|vel analytical (m/s)|vel numerical (m/s)\n",
"-----------------------------------------------\n",
" 0.0 | 0.00 | 0.00\n",
" 2.0 | 18.76 | 18.82\n",
" 4.0 | 32.64 | 32.80\n",
" 6.1 | 40.79 | 40.97\n",
" 8.0 | 44.80 | 44.94\n",
" 10.0 | 46.84 | 46.93\n",
" 12.0 | 47.77 | 47.82\n"
]
},
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.190\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.190\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.190\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.190\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.190\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.190\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.190\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.190\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"43.6,378.0 530.7,378.0 530.7,19.6 43.6,19.6 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M43.6,378.0 L58.3,378.0 M530.8,378.0 L516.1,378.0 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(33.9,384.7)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M43.6,306.3 L58.3,306.3 M530.8,306.3 L516.1,306.3 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(33.9,313.0)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M43.6,234.6 L58.3,234.6 M530.8,234.6 L516.1,234.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(33.9,241.3)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">20</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M43.6,162.9 L58.3,162.9 M530.8,162.9 L516.1,162.9 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(33.9,169.6)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">30</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M43.6,91.2 L58.3,91.2 M530.8,91.2 L516.1,91.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(33.9,97.9)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">40</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M43.6,19.5 L58.3,19.5 M530.8,19.5 L516.1,19.5 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(33.9,26.2)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">50</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M43.6,378.0 L43.6,363.3 M43.6,19.5 L43.6,34.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(43.6,405.7)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M124.8,378.0 L124.8,363.3 M124.8,19.5 L124.8,34.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(124.8,405.7)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">2</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M206.0,378.0 L206.0,363.3 M206.0,19.5 L206.0,34.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(206.0,405.7)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">4</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M287.2,378.0 L287.2,363.3 M287.2,19.5 L287.2,34.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(287.2,405.7)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">6</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M368.4,378.0 L368.4,363.3 M368.4,19.5 L368.4,34.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(368.4,405.7)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">8</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M449.6,378.0 L449.6,363.3 M449.6,19.5 L449.6,34.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(449.6,405.7)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">10</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M530.8,378.0 L530.8,363.3 M530.8,19.5 L530.8,34.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"Helvetica\" font-size=\"18.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(530.8,405.7)\">\n",
"\t\t<text><tspan font-family=\"Helvetica\">12</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M43.6,19.5 L43.6,378.0 L530.8,378.0 L530.8,19.5 L43.6,19.5 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>gnuplot_plot_1a</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"4.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"4.00\">\n",
"\t<path d=\"M43.6,378.0 L47.7,370.9 L51.8,363.8 L55.9,356.7 L60.0,349.7 L64.1,342.7 L68.2,335.7 L72.3,328.7 L76.4,321.8 L80.4,314.9 L84.5,308.0 L88.6,301.3 L92.7,294.5 L96.8,287.9 L100.9,281.3 L105.0,274.8 L109.1,268.4 L113.2,262.0 L117.3,255.8 L121.4,249.6 L125.5,243.5 L129.6,237.5 L133.7,231.6 L137.8,225.9 L141.9,220.2 L146.0,214.6 L150.0,209.1 L154.1,203.7 L158.2,198.5 L162.3,193.3 L166.4,188.3 L170.5,183.4 L174.6,178.6 L178.7,173.8 L182.8,169.3 L186.9,164.8 L191.0,160.4 L195.1,156.1 L199.2,152.0 L203.3,147.9 L207.4,144.0 L211.5,140.2 L215.6,136.4 L219.6,132.8 L223.7,129.3 L227.8,125.9 L231.9,122.6 L236.0,119.3 L240.1,116.2 L244.2,113.2 L248.3,110.2 L252.4,107.4 L256.5,104.6 L260.6,102.0 L264.7,99.4 L268.8,96.9 L272.9,94.5 L277.0,92.1 L281.1,89.9 L285.2,87.7 L289.2,85.5 L293.3,83.5 L297.4,81.5 L301.5,79.6 L305.6,77.8 L309.7,76.0 L313.8,74.3 L317.9,72.6 L322.0,71.0 L326.1,69.5 L330.2,68.0 L334.3,66.6 L338.4,65.2 L342.5,63.8 L346.6,62.6 L350.7,61.3 L354.8,60.1 L358.8,59.0 L362.9,57.9 L367.0,56.8 L371.1,55.8 L375.2,54.8 L379.3,53.8 L383.4,52.9 L387.5,52.0 L391.6,51.2 L395.7,50.4 L399.8,49.6 L403.9,48.8 L408.0,48.1 L412.1,47.4 L416.2,46.7 L420.3,46.1 L424.4,45.4 L428.4,44.8 L432.5,44.3 L436.6,43.7 L440.7,43.2 L444.8,42.7 L448.9,42.2 L453.0,41.7 L457.1,41.2 L461.2,40.8 L465.3,40.4 L469.4,40.0 L473.5,39.6 L477.6,39.2 L481.7,38.8 L485.8,38.5 L489.9,38.2 L494.0,37.9 L498.0,37.5 L502.1,37.3 L506.2,37.0 L510.3,36.7 L514.4,36.4 L518.5,36.2 L522.6,35.9 L526.7,35.7 L530.8,35.5 \" stroke=\"rgb( 0, 0, 255)\"/></g>\n",
"\t</g>\n",
"\t<g id=\"gnuplot_plot_2a\"><title>gnuplot_plot_2a</title>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"4.00\">\n",
"\t<path d=\"M43.6,378.0 L47.7,370.9 L51.8,363.8 L55.9,356.7 L60.0,349.7 L64.1,342.6 L68.2,335.6 L72.3,328.6 L76.4,321.7 L80.4,314.8 L84.5,307.9 L88.6,301.1 L92.7,294.4 L96.8,287.7 L100.9,281.1 L105.0,274.5 L109.1,268.0 L113.2,261.7 L117.3,255.4 L121.4,249.1 L125.5,243.0 L129.6,237.0 L133.7,231.1 L137.8,225.2 L141.9,219.5 L146.0,213.9 L150.0,208.4 L154.1,203.0 L158.2,197.7 L162.3,192.5 L166.4,187.4 L170.5,182.5 L174.6,177.6 L178.7,172.9 L182.8,168.2 L186.9,163.7 L191.0,159.3 L195.1,155.0 L199.2,150.8 L203.3,146.8 L207.4,142.8 L211.5,139.0 L215.6,135.2 L219.6,131.6 L223.7,128.1 L227.8,124.6 L231.9,121.3 L236.0,118.1 L240.1,114.9 L244.2,111.9 L248.3,108.9 L252.4,106.1 L256.5,103.3 L260.6,100.7 L264.7,98.1 L268.8,95.6 L272.9,93.2 L277.0,90.8 L281.1,88.6 L285.2,86.4 L289.2,84.3 L293.3,82.2 L297.4,80.3 L301.5,78.4 L305.6,76.5 L309.7,74.8 L313.8,73.1 L317.9,71.4 L322.0,69.8 L326.1,68.3 L330.2,66.8 L334.3,65.4 L338.4,64.0 L342.5,62.7 L346.6,61.5 L350.7,60.2 L354.8,59.1 L358.8,57.9 L362.9,56.8 L367.0,55.8 L371.1,54.8 L375.2,53.8 L379.3,52.9 L383.4,52.0 L387.5,51.1 L391.6,50.3 L395.7,49.5 L399.8,48.7 L403.9,48.0 L408.0,47.3 L412.1,46.6 L416.2,45.9 L420.3,45.3 L424.4,44.7 L428.4,44.1 L432.5,43.5 L436.6,43.0 L440.7,42.5 L444.8,42.0 L448.9,41.5 L453.0,41.1 L457.1,40.6 L461.2,40.2 L465.3,39.8 L469.4,39.4 L473.5,39.0 L477.6,38.7 L481.7,38.3 L485.8,38.0 L489.9,37.7 L494.0,37.4 L498.0,37.1 L502.1,36.8 L506.2,36.5 L510.3,36.3 L514.4,36.0 L518.5,35.8 L522.6,35.5 L526.7,35.3 L530.8,35.1 \" stroke=\"rgb( 0, 128, 0)\"/>\t<g onmousemove=\"gnuplot_svg.showHypertext(evt,'')\" onmouseout=\"gnuplot_svg.hideHypertext()\"><title> </title>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(43.6,378.0) scale(10.50)\" xlink:href=\"#gpPt5\"/></g>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(47.7,370.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(51.8,363.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(55.9,356.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(60.0,349.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(64.1,342.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(68.2,335.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(72.3,328.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(76.4,321.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(80.4,314.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(84.5,307.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(88.6,301.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(92.7,294.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(96.8,287.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(100.9,281.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(105.0,274.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(109.1,268.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(113.2,261.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(117.3,255.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(121.4,249.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(125.5,243.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(129.6,237.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(133.7,231.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(137.8,225.2) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(141.9,219.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(146.0,213.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(150.0,208.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(154.1,203.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(158.2,197.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(162.3,192.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(166.4,187.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(170.5,182.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(174.6,177.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(178.7,172.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(182.8,168.2) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(186.9,163.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(191.0,159.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(195.1,155.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(199.2,150.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(203.3,146.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(207.4,142.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(211.5,139.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(215.6,135.2) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(219.6,131.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(223.7,128.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(227.8,124.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(231.9,121.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(236.0,118.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(240.1,114.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(244.2,111.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(248.3,108.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(252.4,106.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(256.5,103.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(260.6,100.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(264.7,98.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(268.8,95.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(272.9,93.2) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(277.0,90.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(281.1,88.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(285.2,86.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(289.2,84.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(293.3,82.2) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(297.4,80.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(301.5,78.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(305.6,76.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(309.7,74.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(313.8,73.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(317.9,71.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(322.0,69.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(326.1,68.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(330.2,66.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(334.3,65.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(338.4,64.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(342.5,62.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(346.6,61.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(350.7,60.2) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(354.8,59.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(358.8,57.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(362.9,56.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(367.0,55.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(371.1,54.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(375.2,53.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(379.3,52.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(383.4,52.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(387.5,51.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(391.6,50.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(395.7,49.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(399.8,48.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(403.9,48.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(408.0,47.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(412.1,46.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(416.2,45.9) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(420.3,45.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(424.4,44.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(428.4,44.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(432.5,43.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(436.6,43.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(440.7,42.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(444.8,42.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(448.9,41.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(453.0,41.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(457.1,40.6) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(461.2,40.2) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(465.3,39.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(469.4,39.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(473.5,39.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(477.6,38.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(481.7,38.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(485.8,38.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(489.9,37.7) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(494.0,37.4) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(498.0,37.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(502.1,36.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(506.2,36.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(510.3,36.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(514.4,36.0) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(518.5,35.8) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(522.6,35.5) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(526.7,35.3) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"\t<use color=\"rgb( 0, 128, 0)\" transform=\"translate(530.8,35.1) scale(10.50)\" xlink:href=\"#gpPt5\"/>\n",
"</g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb( 0, 128, 0)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"[v_analytical,v_terminal,t]=freefall(120);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Types of error\n",
"## Freefall is example of \"truncation error\"\n",
"### Truncation error results from approximating exact mathematical procedure"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We approximated the derivative as $\\delta v/\\delta t\\approx\\Delta v/\\Delta t$\n",
"\n",
"Can reduce error by decreasing step size -> $\\Delta t$=`delta_time`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Another example of truncation error is a Taylor series (or Maclaurin if centered at a=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Taylor series:\n",
"$f(x)=f(a)+f'(a)(x-a)+\\frac{f''(a)}{2!}(x-a)^{2}+\\frac{f'''(a)}{3!}(x-a)^{3}+...$\n",
"\n",
"We can approximate the next value in a function by adding Taylor series terms:\n",
"\n",
"|Approximation | formula |\n",
"|---|-------------------------|\n",
"|$0^{th}$-order | $f(x_{i+1})=f(x_{i})+R_{1}$ |\n",
"|$1^{st}$-order | $f(x_{i+1})=f(x_{i})+f'(x_{i})h+R_{2}$ |\n",
"|$2^{nd}$-order | $f(x_{i+1})=f(x_{i})+f'(x_{i})h+\\frac{f''(x_{i})}{2!}h^{2}+R_{3}$|\n",
"|$n^{th}$-order | $f(x_{i+1})=f(x_{i})+f'(x_{i})h+\\frac{f''(x_{i})}{2!}h^{2}+...\\frac{f^{(n)}}{n!}h^{n}+R_{n}$|\n",
"\n",
"Where $R_{n}=\\frac{f^{(n+1)}(\\xi)}{(n+1)!}h^{n+1}$ is the error associated with truncating the approximation at order $n$.\n",
"\n",
"The $n^{th}$-order approximation estimates that the unknown function, $f(x)$, is equal to an $n^{th}$-order polynomial. \n",
"\n",
"In the Freefall example, we estimated the function with a $1^{st}$-order approximation, so \n",
"\n",
"$v(t_{i+1})=v(t_{i})+v'(t_{i})(t_{i+1}-t_{i})+R_{1}$\n",
"\n",
"$v'(t_{i})=\\frac{v(t_{i+1})-v(t_{i})}{t_{i+1}-t_{i}}-\\frac{R_{1}}{t_{i+1}-t_{i}}$\n",
"\n",
"$\\frac{R_{1}}{t_{i+1}-t_{i}}=\\frac{v''(\\xi)}{2!}(t_{i+1}-t_{i})$\n",
"\n",
"or the truncation error for a first-order Taylor series approximation is\n",
"\n",
"$\\frac{R_{1}}{t_{i+1}-t_{i}}=O(\\Delta t)$\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"1. digital representation of a number is rarely exact\n",
"\n",
"2. arithmetic (+,-,/,\\*) causes roundoff error"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3.14159265358979311600\n",
"3.14159274101257324219\n"
]
}
],
"source": [
"fprintf('%1.20f\\n',double(pi))\n",
"fprintf('%1.20f\\n',single(pi))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Octave",
"language": "octave",
"name": "octave"
},
"language_info": {
"file_extension": ".m",
"help_links": [
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-octave",
"name": "octave",
"version": "0.19.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}