589 lines
59 KiB
Plaintext
589 lines
59 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Week 3 - Fitting a curve"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"Plots.GRBackend()"
|
|
]
|
|
},
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# You may need this setup\n",
|
|
"using Plots\n",
|
|
"gr() # Activate the GR backend for use with Plots"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"using DelimitedFiles"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Import the supplied data representing 15 pairs to x- and y-values. "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"data_tofit = readdlm(\"Week3_PR_Data.dat\", '\\t');"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[0.1268004831284406, -1.6416953879765301]\n",
|
|
"[0.5013092807380928, -0.9776975375269383]\n",
|
|
"[1.5280121125586477, 0.5277112203195138]\n",
|
|
"[1.7001225303407743, 1.711524991194374]\n",
|
|
"[1.9924936253216172, 1.8910000148140624]\n",
|
|
"[2.706075824201991, -0.46342779446395]\n",
|
|
"[2.9949319274309043, -0.4435666186385725]\n",
|
|
"[3.4918528112833935, -1.275179133203867]\n",
|
|
"[3.501191722475427, -0.6904995966451337]\n",
|
|
"[4.459924502120439, -5.51613079927097]\n",
|
|
"[4.936965850879389, -6.001703074115855]\n",
|
|
"[5.023289852369695, -8.364169009651015]\n",
|
|
"[5.042336980089736, -7.924477516763416]\n",
|
|
"[5.507392850419521, -10.774823709545498]\n",
|
|
"[5.568665171088307, -10.917187797703853]\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"for i = 1:size(data_tofit)[1]\n",
|
|
" println(data_tofit[i,:])\n",
|
|
"end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"x, y = data_tofit[:,1], data_tofit[:,2];"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Then we do a scatterplot, this gives us the points the line must go through."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"image/svg+xml": [
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
|
|
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
|
|
"<defs>\n",
|
|
" <clipPath id=\"clip7100\">\n",
|
|
" <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
|
|
" </clipPath>\n",
|
|
"</defs>\n",
|
|
"<path clip-path=\"url(#clip7100)\" d=\"\n",
|
|
"M0 1600 L2400 1600 L2400 0 L0 0 Z\n",
|
|
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
|
|
"<defs>\n",
|
|
" <clipPath id=\"clip7101\">\n",
|
|
" <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
|
|
" </clipPath>\n",
|
|
"</defs>\n",
|
|
"<path clip-path=\"url(#clip7100)\" d=\"\n",
|
|
"M189.237 1486.45 L2352.76 1486.45 L2352.76 47.2441 L189.237 47.2441 Z\n",
|
|
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
|
|
"<defs>\n",
|
|
" <clipPath id=\"clip7102\">\n",
|
|
" <rect x=\"189\" y=\"47\" width=\"2165\" height=\"1440\"/>\n",
|
|
" </clipPath>\n",
|
|
"</defs>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 202.91,1486.45 202.91,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 577.976,1486.45 577.976,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 953.041,1486.45 953.041,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 1328.11,1486.45 1328.11,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 1703.17,1486.45 1703.17,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 2078.24,1486.45 2078.24,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 189.237,1348.49 2352.76,1348.49 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 189.237,1083.47 2352.76,1083.47 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 189.237,818.461 2352.76,818.461 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 189.237,553.447 2352.76,553.447 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7102)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 189.237,288.433 2352.76,288.433 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 189.237,1486.45 2352.76,1486.45 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 189.237,1486.45 189.237,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 202.91,1486.45 202.91,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 577.976,1486.45 577.976,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 953.041,1486.45 953.041,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 1328.11,1486.45 1328.11,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 1703.17,1486.45 1703.17,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 2078.24,1486.45 2078.24,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 189.237,1348.49 215.199,1348.49 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 189.237,1083.47 215.199,1083.47 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 189.237,818.461 215.199,818.461 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 189.237,553.447 215.199,553.447 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7100)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 189.237,288.433 215.199,288.433 \n",
|
|
" \"/>\n",
|
|
"<path clip-path=\"url(#clip7100)\" d=\"M 0 0 M202.91 1508.44 Q199.299 1508.44 197.47 1512 Q195.665 1515.55 195.665 1522.67 Q195.665 1529.78 197.47 1533.35 Q199.299 1536.89 202.91 1536.89 Q206.544 1536.89 208.35 1533.35 Q210.179 1529.78 210.179 1522.67 Q210.179 1515.55 208.35 1512 Q206.544 1508.44 202.91 1508.44 M202.91 1504.73 Q208.72 1504.73 211.776 1509.34 Q214.855 1513.92 214.855 1522.67 Q214.855 1531.4 211.776 1536.01 Q208.72 1540.59 202.91 1540.59 Q197.1 1540.59 194.021 1536.01 Q190.966 1531.4 190.966 1522.67 Q190.966 1513.92 194.021 1509.34 Q197.1 1504.73 202.91 1504.73 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M568.358 1535.98 L575.996 1535.98 L575.996 1509.62 L567.686 1511.29 L567.686 1507.03 L575.95 1505.36 L580.626 1505.36 L580.626 1535.98 L588.265 1535.98 L588.265 1539.92 L568.358 1539.92 L568.358 1535.98 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M947.694 1535.98 L964.013 1535.98 L964.013 1539.92 L942.069 1539.92 L942.069 1535.98 Q944.731 1533.23 949.314 1528.6 Q953.921 1523.95 955.101 1522.61 Q957.347 1520.08 958.226 1518.35 Q959.129 1516.59 959.129 1514.9 Q959.129 1512.14 957.185 1510.41 Q955.263 1508.67 952.161 1508.67 Q949.962 1508.67 947.509 1509.43 Q945.078 1510.2 942.3 1511.75 L942.3 1507.03 Q945.124 1505.89 947.578 1505.31 Q950.032 1504.73 952.069 1504.73 Q957.439 1504.73 960.634 1507.42 Q963.828 1510.11 963.828 1514.6 Q963.828 1516.73 963.018 1518.65 Q962.231 1520.54 960.124 1523.14 Q959.546 1523.81 956.444 1527.03 Q953.342 1530.22 947.694 1535.98 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M1332.35 1521.29 Q1335.71 1522 1337.59 1524.27 Q1339.48 1526.54 1339.48 1529.87 Q1339.48 1534.99 1335.97 1537.79 Q1332.45 1540.59 1325.97 1540.59 Q1323.79 1540.59 1321.47 1540.15 Q1319.18 1539.73 1316.73 1538.88 L1316.73 1534.36 Q1318.67 1535.5 1320.99 1536.08 Q1323.3 1536.66 1325.83 1536.66 Q1330.22 1536.66 1332.52 1534.92 Q1334.83 1533.18 1334.83 1529.87 Q1334.83 1526.82 1332.68 1525.11 Q1330.55 1523.37 1326.73 1523.37 L1322.7 1523.37 L1322.7 1519.53 L1326.91 1519.53 Q1330.36 1519.53 1332.19 1518.16 Q1334.02 1516.77 1334.02 1514.18 Q1334.02 1511.52 1332.12 1510.11 Q1330.25 1508.67 1326.73 1508.67 Q1324.81 1508.67 1322.61 1509.09 Q1320.41 1509.5 1317.77 1510.38 L1317.77 1506.22 Q1320.43 1505.48 1322.75 1505.11 Q1325.09 1504.73 1327.15 1504.73 Q1332.47 1504.73 1335.57 1507.17 Q1338.67 1509.57 1338.67 1513.69 Q1338.67 1516.56 1337.03 1518.55 Q1335.39 1520.52 1332.35 1521.29 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M1706.18 1509.43 L1694.38 1527.88 L1706.18 1527.88 L1706.18 1509.43 M1704.95 1505.36 L1710.83 1505.36 L1710.83 1527.88 L1715.76 1527.88 L1715.76 1531.77 L1710.83 1531.77 L1710.83 1539.92 L1706.18 1539.92 L1706.18 1531.77 L1690.58 1531.77 L1690.58 1527.26 L1704.95 1505.36 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M2068.52 1505.36 L2086.87 1505.36 L2086.87 1509.3 L2072.8 1509.3 L2072.8 1517.77 Q2073.82 1517.42 2074.83 1517.26 Q2075.85 1517.07 2076.87 1517.07 Q2082.66 1517.07 2086.04 1520.24 Q2089.42 1523.42 2089.42 1528.83 Q2089.42 1534.41 2085.95 1537.51 Q2082.47 1540.59 2076.15 1540.59 Q2073.98 1540.59 2071.71 1540.22 Q2069.46 1539.85 2067.06 1539.11 L2067.06 1534.41 Q2069.14 1535.54 2071.36 1536.1 Q2073.58 1536.66 2076.06 1536.66 Q2080.07 1536.66 2082.4 1534.55 Q2084.74 1532.44 2084.74 1528.83 Q2084.74 1525.22 2082.4 1523.11 Q2080.07 1521.01 2076.06 1521.01 Q2074.19 1521.01 2072.31 1521.42 Q2070.46 1521.84 2068.52 1522.72 L2068.52 1505.36 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M62.9921 1350.88 L75.4689 1350.88 L75.4689 1354.68 L62.9921 1354.68 L62.9921 1350.88 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M81.3485 1361.83 L88.9874 1361.83 L88.9874 1335.47 L80.6772 1337.13 L80.6772 1332.88 L88.9411 1331.21 L93.617 1331.21 L93.617 1361.83 L101.256 1361.83 L101.256 1365.77 L81.3485 1365.77 L81.3485 1361.83 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M116.325 1334.29 Q112.714 1334.29 110.885 1337.85 Q109.08 1341.39 109.08 1348.52 Q109.08 1355.63 110.885 1359.19 Q112.714 1362.74 116.325 1362.74 Q119.959 1362.74 121.765 1359.19 Q123.594 1355.63 123.594 1348.52 Q123.594 1341.39 121.765 1337.85 Q119.959 1334.29 116.325 1334.29 M116.325 1330.58 Q122.135 1330.58 125.191 1335.19 Q128.27 1339.77 128.27 1348.52 Q128.27 1357.25 125.191 1361.86 Q122.135 1366.44 116.325 1366.44 Q110.515 1366.44 107.436 1361.86 Q104.381 1357.25 104.381 1348.52 Q104.381 1339.77 107.436 1335.19 Q110.515 1330.58 116.325 1330.58 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M133.339 1359.89 L138.223 1359.89 L138.223 1365.77 L133.339 1365.77 L133.339 1359.89 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M153.293 1334.29 Q149.681 1334.29 147.853 1337.85 Q146.047 1341.39 146.047 1348.52 Q146.047 1355.63 147.853 1359.19 Q149.681 1362.74 153.293 1362.74 Q156.927 1362.74 158.732 1359.19 Q160.561 1355.63 160.561 1348.52 Q160.561 1341.39 158.732 1337.85 Q156.927 1334.29 153.293 1334.29 M153.293 1330.58 Q159.103 1330.58 162.158 1335.19 Q165.237 1339.77 165.237 1348.52 Q165.237 1357.25 162.158 1361.86 Q159.103 1366.44 153.293 1366.44 Q147.482 1366.44 144.404 1361.86 Q141.348 1357.25 141.348 1348.52 Q141.348 1339.77 144.404 1335.19 Q147.482 1330.58 153.293 1330.58 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M90.6772 1085.87 L103.154 1085.87 L103.154 1089.67 L90.6772 1089.67 L90.6772 1085.87 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M107.043 1066.19 L129.265 1066.19 L129.265 1068.19 L116.719 1100.75 L111.834 1100.75 L123.64 1070.13 L107.043 1070.13 L107.043 1066.19 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M134.334 1094.88 L139.219 1094.88 L139.219 1100.75 L134.334 1100.75 L134.334 1094.88 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M144.334 1066.19 L162.691 1066.19 L162.691 1070.13 L148.617 1070.13 L148.617 1078.6 Q149.635 1078.25 150.654 1078.09 Q151.672 1077.91 152.691 1077.91 Q158.478 1077.91 161.857 1081.08 Q165.237 1084.25 165.237 1089.67 Q165.237 1095.25 161.765 1098.35 Q158.293 1101.43 151.973 1101.43 Q149.797 1101.43 147.529 1101.06 Q145.283 1100.69 142.876 1099.94 L142.876 1095.25 Q144.959 1096.38 147.181 1096.94 Q149.404 1097.49 151.881 1097.49 Q155.885 1097.49 158.223 1095.38 Q160.561 1093.28 160.561 1089.67 Q160.561 1086.06 158.223 1083.95 Q155.885 1081.84 151.881 1081.84 Q150.006 1081.84 148.131 1082.26 Q146.279 1082.68 144.334 1083.56 L144.334 1066.19 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M89.7744 820.857 L102.251 820.857 L102.251 824.653 L89.7744 824.653 L89.7744 820.857 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M107.367 801.181 L125.723 801.181 L125.723 805.116 L111.649 805.116 L111.649 813.588 Q112.668 813.241 113.686 813.079 Q114.705 812.894 115.723 812.894 Q121.51 812.894 124.89 816.065 Q128.27 819.236 128.27 824.653 Q128.27 830.232 124.797 833.333 Q121.325 836.412 115.006 836.412 Q112.83 836.412 110.561 836.042 Q108.316 835.671 105.909 834.931 L105.909 830.232 Q107.992 831.366 110.214 831.921 Q112.436 832.477 114.913 832.477 Q118.918 832.477 121.256 830.37 Q123.594 828.264 123.594 824.653 Q123.594 821.042 121.256 818.935 Q118.918 816.829 114.913 816.829 Q113.038 816.829 111.163 817.245 Q109.311 817.662 107.367 818.542 L107.367 801.181 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M133.339 829.861 L138.223 829.861 L138.223 835.741 L133.339 835.741 L133.339 829.861 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M153.293 804.259 Q149.681 804.259 147.853 807.824 Q146.047 811.366 146.047 818.495 Q146.047 825.602 147.853 829.167 Q149.681 832.708 153.293 832.708 Q156.927 832.708 158.732 829.167 Q160.561 825.602 160.561 818.495 Q160.561 811.366 158.732 807.824 Q156.927 804.259 153.293 804.259 M153.293 800.556 Q159.103 800.556 162.158 805.162 Q165.237 809.746 165.237 818.495 Q165.237 827.222 162.158 831.829 Q159.103 836.412 153.293 836.412 Q147.482 836.412 144.404 831.829 Q141.348 827.222 141.348 818.495 Q141.348 809.746 144.404 805.162 Q147.482 800.556 153.293 800.556 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M91.3716 555.843 L103.848 555.843 L103.848 559.639 L91.3716 559.639 L91.3716 555.843 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M112.946 566.792 L129.265 566.792 L129.265 570.727 L107.321 570.727 L107.321 566.792 Q109.983 564.037 114.566 559.407 Q119.172 554.755 120.353 553.412 Q122.598 550.889 123.478 549.153 Q124.381 547.394 124.381 545.704 Q124.381 542.949 122.436 541.213 Q120.515 539.477 117.413 539.477 Q115.214 539.477 112.76 540.241 Q110.33 541.005 107.552 542.556 L107.552 537.833 Q110.376 536.699 112.83 536.12 Q115.284 535.542 117.321 535.542 Q122.691 535.542 125.885 538.227 Q129.08 540.912 129.08 545.403 Q129.08 547.532 128.27 549.454 Q127.483 551.352 125.376 553.944 Q124.797 554.616 121.696 557.833 Q118.594 561.028 112.946 566.792 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M134.334 564.847 L139.219 564.847 L139.219 570.727 L134.334 570.727 L134.334 564.847 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M144.334 536.167 L162.691 536.167 L162.691 540.102 L148.617 540.102 L148.617 548.574 Q149.635 548.227 150.654 548.065 Q151.672 547.88 152.691 547.88 Q158.478 547.88 161.857 551.051 Q165.237 554.222 165.237 559.639 Q165.237 565.218 161.765 568.319 Q158.293 571.398 151.973 571.398 Q149.797 571.398 147.529 571.028 Q145.283 570.657 142.876 569.917 L142.876 565.218 Q144.959 566.352 147.181 566.907 Q149.404 567.463 151.881 567.463 Q155.885 567.463 158.223 565.356 Q160.561 563.25 160.561 559.639 Q160.561 556.028 158.223 553.921 Q155.885 551.815 151.881 551.815 Q150.006 551.815 148.131 552.232 Q146.279 552.648 144.334 553.528 L144.334 536.167 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M116.325 274.232 Q112.714 274.232 110.885 277.796 Q109.08 281.338 109.08 288.468 Q109.08 295.574 110.885 299.139 Q112.714 302.68 116.325 302.68 Q119.959 302.68 121.765 299.139 Q123.594 295.574 123.594 288.468 Q123.594 281.338 121.765 277.796 Q119.959 274.232 116.325 274.232 M116.325 270.528 Q122.135 270.528 125.191 275.134 Q128.27 279.718 128.27 288.468 Q128.27 297.194 125.191 301.801 Q122.135 306.384 116.325 306.384 Q110.515 306.384 107.436 301.801 Q104.381 297.194 104.381 288.468 Q104.381 279.718 107.436 275.134 Q110.515 270.528 116.325 270.528 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M133.339 299.833 L138.223 299.833 L138.223 305.713 L133.339 305.713 L133.339 299.833 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7100)\" d=\"M 0 0 M153.293 274.232 Q149.681 274.232 147.853 277.796 Q146.047 281.338 146.047 288.468 Q146.047 295.574 147.853 299.139 Q149.681 302.68 153.293 302.68 Q156.927 302.68 158.732 299.139 Q160.561 295.574 160.561 288.468 Q160.561 281.338 158.732 277.796 Q156.927 274.232 153.293 274.232 M153.293 270.528 Q159.103 270.528 162.158 275.134 Q165.237 279.718 165.237 288.468 Q165.237 297.194 162.158 301.801 Q159.103 306.384 153.293 306.384 Q147.482 306.384 144.404 301.801 Q141.348 297.194 141.348 288.468 Q141.348 279.718 144.404 275.134 Q147.482 270.528 153.293 270.528 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><circle clip-path=\"url(#clip7102)\" cx=\"250.469\" cy=\"462.462\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"390.934\" cy=\"392.074\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"776.015\" cy=\"232.493\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"840.567\" cy=\"107.002\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"950.226\" cy=\"87.9763\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"1217.87\" cy=\"337.559\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"1326.21\" cy=\"335.453\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"1512.58\" cy=\"423.609\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"1516.09\" cy=\"361.63\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"1875.67\" cy=\"873.173\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"2054.6\" cy=\"924.647\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"2086.97\" cy=\"1175.08\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"2094.12\" cy=\"1128.47\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"2268.54\" cy=\"1430.62\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7102)\" cx=\"2291.52\" cy=\"1445.72\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"</svg>\n"
|
|
]
|
|
},
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Plot the x and y data points using a scatter plot of the x and y array variables\n",
|
|
"plot(x,y,line=:scatter,legend=:false)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"For the line, we need a function, which we now define. Note that the parameters a, b, c need not be passed to the function: we will keep resetting them to try to improve the fit."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"parabfit (generic function with 1 method)"
|
|
]
|
|
},
|
|
"execution_count": 7,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Create a function called parabfit, with x as the argument, returning a*x^2 + b*x + c\n",
|
|
"function parabfit(x)\n",
|
|
" return a*x^2 + b*x + c\n",
|
|
"end"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Let's check that we do get a reasonable parabola. Choose your own interval [xmin, xmax] and parameters a, b, c. If it looks too much like a straight line, chance your choices until it does."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"image/svg+xml": [
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
|
|
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
|
|
"<defs>\n",
|
|
" <clipPath id=\"clip7500\">\n",
|
|
" <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
|
|
" </clipPath>\n",
|
|
"</defs>\n",
|
|
"<path clip-path=\"url(#clip7500)\" d=\"\n",
|
|
"M0 1600 L2400 1600 L2400 0 L0 0 Z\n",
|
|
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
|
|
"<defs>\n",
|
|
" <clipPath id=\"clip7501\">\n",
|
|
" <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
|
|
" </clipPath>\n",
|
|
"</defs>\n",
|
|
"<path clip-path=\"url(#clip7500)\" d=\"\n",
|
|
"M136.76 1486.45 L2352.76 1486.45 L2352.76 47.2441 L136.76 47.2441 Z\n",
|
|
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
|
|
"<defs>\n",
|
|
" <clipPath id=\"clip7502\">\n",
|
|
" <rect x=\"136\" y=\"47\" width=\"2217\" height=\"1440\"/>\n",
|
|
" </clipPath>\n",
|
|
"</defs>\n",
|
|
"<polyline clip-path=\"url(#clip7502)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 408.533,1486.45 408.533,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7502)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 826.646,1486.45 826.646,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7502)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 1244.76,1486.45 1244.76,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7502)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 1662.87,1486.45 1662.87,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7502)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 2080.98,1486.45 2080.98,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7502)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 136.76,1479.38 2352.76,1479.38 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7502)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 136.76,1030.54 2352.76,1030.54 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7502)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 136.76,581.7 2352.76,581.7 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7502)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 136.76,132.86 2352.76,132.86 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 136.76,1486.45 2352.76,1486.45 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 136.76,1486.45 136.76,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 408.533,1486.45 408.533,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 826.646,1486.45 826.646,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 1244.76,1486.45 1244.76,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 1662.87,1486.45 1662.87,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 2080.98,1486.45 2080.98,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 136.76,1479.38 163.352,1479.38 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 136.76,1030.54 163.352,1030.54 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 136.76,581.7 163.352,581.7 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 136.76,132.86 163.352,132.86 \n",
|
|
" \"/>\n",
|
|
"<path clip-path=\"url(#clip7500)\" d=\"M 0 0 M388.545 1525.04 L401.022 1525.04 L401.022 1528.83 L388.545 1528.83 L388.545 1525.04 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M418.938 1509.43 L407.133 1527.88 L418.938 1527.88 L418.938 1509.43 M417.712 1505.36 L423.591 1505.36 L423.591 1527.88 L428.522 1527.88 L428.522 1531.77 L423.591 1531.77 L423.591 1539.92 L418.938 1539.92 L418.938 1531.77 L403.337 1531.77 L403.337 1527.26 L417.712 1505.36 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M807.699 1525.04 L820.176 1525.04 L820.176 1528.83 L807.699 1528.83 L807.699 1525.04 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M829.273 1535.98 L845.592 1535.98 L845.592 1539.92 L823.648 1539.92 L823.648 1535.98 Q826.31 1533.23 830.893 1528.6 Q835.5 1523.95 836.68 1522.61 Q838.926 1520.08 839.805 1518.35 Q840.708 1516.59 840.708 1514.9 Q840.708 1512.14 838.764 1510.41 Q836.842 1508.67 833.741 1508.67 Q831.542 1508.67 829.088 1509.43 Q826.657 1510.2 823.88 1511.75 L823.88 1507.03 Q826.704 1505.89 829.157 1505.31 Q831.611 1504.73 833.648 1504.73 Q839.018 1504.73 842.213 1507.42 Q845.407 1510.11 845.407 1514.6 Q845.407 1516.73 844.597 1518.65 Q843.81 1520.54 841.704 1523.14 Q841.125 1523.81 838.023 1527.03 Q834.921 1530.22 829.273 1535.98 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M1244.76 1508.44 Q1241.15 1508.44 1239.32 1512 Q1237.51 1515.55 1237.51 1522.67 Q1237.51 1529.78 1239.32 1533.35 Q1241.15 1536.89 1244.76 1536.89 Q1248.39 1536.89 1250.2 1533.35 Q1252.03 1529.78 1252.03 1522.67 Q1252.03 1515.55 1250.2 1512 Q1248.39 1508.44 1244.76 1508.44 M1244.76 1504.73 Q1250.57 1504.73 1253.62 1509.34 Q1256.7 1513.92 1256.7 1522.67 Q1256.7 1531.4 1253.62 1536.01 Q1250.57 1540.59 1244.76 1540.59 Q1238.95 1540.59 1235.87 1536.01 Q1232.81 1531.4 1232.81 1522.67 Q1232.81 1513.92 1235.87 1509.34 Q1238.95 1504.73 1244.76 1504.73 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M1657.52 1535.98 L1673.84 1535.98 L1673.84 1539.92 L1651.9 1539.92 L1651.9 1535.98 Q1654.56 1533.23 1659.14 1528.6 Q1663.75 1523.95 1664.93 1522.61 Q1667.18 1520.08 1668.06 1518.35 Q1668.96 1516.59 1668.96 1514.9 Q1668.96 1512.14 1667.01 1510.41 Q1665.09 1508.67 1661.99 1508.67 Q1659.79 1508.67 1657.34 1509.43 Q1654.91 1510.2 1652.13 1511.75 L1652.13 1507.03 Q1654.95 1505.89 1657.41 1505.31 Q1659.86 1504.73 1661.9 1504.73 Q1667.27 1504.73 1670.46 1507.42 Q1673.66 1510.11 1673.66 1514.6 Q1673.66 1516.73 1672.85 1518.65 Q1672.06 1520.54 1669.95 1523.14 Q1669.38 1523.81 1666.27 1527.03 Q1663.17 1530.22 1657.52 1535.98 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M2083.99 1509.43 L2072.19 1527.88 L2083.99 1527.88 L2083.99 1509.43 M2082.77 1505.36 L2088.64 1505.36 L2088.64 1527.88 L2093.58 1527.88 L2093.58 1531.77 L2088.64 1531.77 L2088.64 1539.92 L2083.99 1539.92 L2083.99 1531.77 L2068.39 1531.77 L2068.39 1527.26 L2082.77 1505.36 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M100.816 1465.18 Q97.2049 1465.18 95.3762 1468.74 Q93.5707 1472.28 93.5707 1479.41 Q93.5707 1486.52 95.3762 1490.08 Q97.2049 1493.63 100.816 1493.63 Q104.45 1493.63 106.256 1490.08 Q108.084 1486.52 108.084 1479.41 Q108.084 1472.28 106.256 1468.74 Q104.45 1465.18 100.816 1465.18 M100.816 1461.47 Q106.626 1461.47 109.682 1466.08 Q112.76 1470.66 112.76 1479.41 Q112.76 1488.14 109.682 1492.75 Q106.626 1497.33 100.816 1497.33 Q95.0058 1497.33 91.9272 1492.75 Q88.8716 1488.14 88.8716 1479.41 Q88.8716 1470.66 91.9272 1466.08 Q95.0058 1461.47 100.816 1461.47 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M65.8393 1043.88 L73.4782 1043.88 L73.4782 1017.52 L65.168 1019.19 L65.168 1014.93 L73.4319 1013.26 L78.1078 1013.26 L78.1078 1043.88 L85.7466 1043.88 L85.7466 1047.82 L65.8393 1047.82 L65.8393 1043.88 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M100.816 1016.34 Q97.2049 1016.34 95.3762 1019.9 Q93.5707 1023.44 93.5707 1030.57 Q93.5707 1037.68 95.3762 1041.25 Q97.2049 1044.79 100.816 1044.79 Q104.45 1044.79 106.256 1041.25 Q108.084 1037.68 108.084 1030.57 Q108.084 1023.44 106.256 1019.9 Q104.45 1016.34 100.816 1016.34 M100.816 1012.63 Q106.626 1012.63 109.682 1017.24 Q112.76 1021.82 112.76 1030.57 Q112.76 1039.3 109.682 1043.91 Q106.626 1048.49 100.816 1048.49 Q95.0058 1048.49 91.9272 1043.91 Q88.8716 1039.3 88.8716 1030.57 Q88.8716 1021.82 91.9272 1017.24 Q95.0058 1012.63 100.816 1012.63 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M69.4273 595.045 L85.7466 595.045 L85.7466 598.98 L63.8023 598.98 L63.8023 595.045 Q66.4643 592.29 71.0476 587.66 Q75.6541 583.008 76.8346 581.665 Q79.08 579.142 79.9596 577.406 Q80.8624 575.646 80.8624 573.957 Q80.8624 571.202 78.918 569.466 Q76.9967 567.73 73.8948 567.73 Q71.6958 567.73 69.2421 568.494 Q66.8115 569.258 64.0338 570.809 L64.0338 566.086 Q66.8578 564.952 69.3115 564.373 Q71.7652 563.795 73.8023 563.795 Q79.1726 563.795 82.367 566.48 Q85.5614 569.165 85.5614 573.656 Q85.5614 575.785 84.7513 577.707 Q83.9642 579.605 81.8578 582.197 Q81.2791 582.869 78.1772 586.086 Q75.0754 589.281 69.4273 595.045 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M100.816 567.498 Q97.2049 567.498 95.3762 571.063 Q93.5707 574.605 93.5707 581.734 Q93.5707 588.841 95.3762 592.406 Q97.2049 595.947 100.816 595.947 Q104.45 595.947 106.256 592.406 Q108.084 588.841 108.084 581.734 Q108.084 574.605 106.256 571.063 Q104.45 567.498 100.816 567.498 M100.816 563.795 Q106.626 563.795 109.682 568.401 Q112.76 572.984 112.76 581.734 Q112.76 590.461 109.682 595.068 Q106.626 599.651 100.816 599.651 Q95.0058 599.651 91.9272 595.068 Q88.8716 590.461 88.8716 581.734 Q88.8716 572.984 91.9272 568.401 Q95.0058 563.795 100.816 563.795 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M78.617 131.506 Q81.9735 132.224 83.8485 134.492 Q85.7466 136.761 85.7466 140.094 Q85.7466 145.21 82.2281 148.011 Q78.7096 150.812 72.2282 150.812 Q70.0523 150.812 67.7375 150.372 Q65.4458 149.955 62.9921 149.099 L62.9921 144.585 Q64.9366 145.719 67.2514 146.298 Q69.5662 146.876 72.0893 146.876 Q76.4874 146.876 78.7791 145.14 Q81.0939 143.404 81.0939 140.094 Q81.0939 137.038 78.9411 135.325 Q76.8115 133.589 72.9921 133.589 L68.9643 133.589 L68.9643 129.747 L73.1773 129.747 Q76.6263 129.747 78.455 128.381 Q80.2837 126.992 80.2837 124.4 Q80.2837 121.738 78.3856 120.326 Q76.5106 118.89 72.9921 118.89 Q71.0708 118.89 68.8717 119.307 Q66.6727 119.724 64.0338 120.603 L64.0338 116.437 Q66.6958 115.696 69.0106 115.326 Q71.3486 114.955 73.4087 114.955 Q78.7328 114.955 81.8346 117.386 Q84.9365 119.793 84.9365 123.914 Q84.9365 126.784 83.2929 128.775 Q81.6494 130.742 78.617 131.506 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M100.816 118.659 Q97.2049 118.659 95.3762 122.224 Q93.5707 125.765 93.5707 132.895 Q93.5707 140.001 95.3762 143.566 Q97.2049 147.108 100.816 147.108 Q104.45 147.108 106.256 143.566 Q108.084 140.001 108.084 132.895 Q108.084 125.765 106.256 122.224 Q104.45 118.659 100.816 118.659 M100.816 114.955 Q106.626 114.955 109.682 119.562 Q112.76 124.145 112.76 132.895 Q112.76 141.622 109.682 146.228 Q106.626 150.812 100.816 150.812 Q95.0058 150.812 91.9272 146.228 Q88.8716 141.622 88.8716 132.895 Q88.8716 124.145 91.9272 119.562 Q95.0058 114.955 100.816 114.955 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><polyline clip-path=\"url(#clip7502)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 199.477,536.816 304.005,727.573 408.533,895.887 513.062,1041.76 617.59,1165.19 722.118,1266.18 826.646,1344.73 931.174,1400.83 1035.7,1434.49 1140.23,1445.72 \n",
|
|
" 1244.76,1434.49 1349.29,1400.83 1453.81,1344.73 1558.34,1266.18 1662.87,1165.19 1767.4,1041.76 1871.93,895.887 1976.45,727.573 2080.98,536.816 2185.51,323.617 \n",
|
|
" 2290.04,87.9763 \n",
|
|
" \"/>\n",
|
|
"<path clip-path=\"url(#clip7500)\" d=\"\n",
|
|
"M1989.74 251.724 L2280.76 251.724 L2280.76 130.764 L1989.74 130.764 Z\n",
|
|
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 1989.74,251.724 2280.76,251.724 2280.76,130.764 1989.74,130.764 1989.74,251.724 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7500)\" style=\"stroke:#009af9; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 2013.74,191.244 2157.74,191.244 \n",
|
|
" \"/>\n",
|
|
"<path clip-path=\"url(#clip7500)\" d=\"M 0 0 M2195.58 210.931 Q2193.77 215.561 2192.06 216.973 Q2190.35 218.385 2187.48 218.385 L2184.08 218.385 L2184.08 214.82 L2186.58 214.82 Q2188.33 214.82 2189.31 213.987 Q2190.28 213.154 2191.46 210.052 L2192.22 208.107 L2181.74 182.598 L2186.25 182.598 L2194.35 202.876 L2202.46 182.598 L2206.97 182.598 L2195.58 210.931 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7500)\" d=\"M 0 0 M2212.85 204.589 L2220.49 204.589 L2220.49 178.223 L2212.18 179.89 L2212.18 175.631 L2220.44 173.964 L2225.12 173.964 L2225.12 204.589 L2232.76 204.589 L2232.76 208.524 L2212.85 208.524 L2212.85 204.589 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /></svg>\n"
|
|
]
|
|
},
|
|
"execution_count": 8,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# Create variables a, b and c, assigning each the value 1\n",
|
|
"a = 1\n",
|
|
"b = 1\n",
|
|
"c = 1\n",
|
|
"\n",
|
|
"f = Array{Float64}(undef,length(-5:0.5:5))\n",
|
|
"\n",
|
|
"# Plot the function parabfit, for x values between -5 and 5 \n",
|
|
"i = 1\n",
|
|
"for j = -5:0.5:5\n",
|
|
" f[i] = parabfit(j) \n",
|
|
" i = i + 1\n",
|
|
"end\n",
|
|
"\n",
|
|
"plot(-5:0.5:5,f)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Now we choose a, b, c and plot the curve together with the points. \n",
|
|
"\n",
|
|
"Note that by looking at where the data points lie, we can deduce some of the properties for a, b, c, as follows.\n",
|
|
"\n",
|
|
"The plot must have a y-intersection that is close to 0, so c is close to 0. Also, the parabola is open downwards, so a must be negative. Finally, it has its maximum at a positive x, so b must be positive. \n",
|
|
"\n",
|
|
"Use plot() to start with the scatter plot and plot!() to add the curve for parabfit. (There are other ways to do this ...)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"image/svg+xml": [
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
|
|
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 2400 1600\">\n",
|
|
"<defs>\n",
|
|
" <clipPath id=\"clip7900\">\n",
|
|
" <rect x=\"0\" y=\"0\" width=\"2400\" height=\"1600\"/>\n",
|
|
" </clipPath>\n",
|
|
"</defs>\n",
|
|
"<path clip-path=\"url(#clip7900)\" d=\"\n",
|
|
"M0 1600 L2400 1600 L2400 0 L0 0 Z\n",
|
|
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
|
|
"<defs>\n",
|
|
" <clipPath id=\"clip7901\">\n",
|
|
" <rect x=\"480\" y=\"0\" width=\"1681\" height=\"1600\"/>\n",
|
|
" </clipPath>\n",
|
|
"</defs>\n",
|
|
"<path clip-path=\"url(#clip7900)\" d=\"\n",
|
|
"M152.27 1486.45 L2352.76 1486.45 L2352.76 47.2441 L152.27 47.2441 Z\n",
|
|
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
|
|
"<defs>\n",
|
|
" <clipPath id=\"clip7902\">\n",
|
|
" <rect x=\"152\" y=\"47\" width=\"2201\" height=\"1440\"/>\n",
|
|
" </clipPath>\n",
|
|
"</defs>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 214.547,1486.45 214.547,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 560.536,1486.45 560.536,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 906.524,1486.45 906.524,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 1252.51,1486.45 1252.51,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 1598.5,1486.45 1598.5,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 1944.49,1486.45 1944.49,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 2290.48,1486.45 2290.48,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 152.27,1445.72 2352.76,1445.72 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 152.27,1043.8 2352.76,1043.8 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 152.27,641.892 2352.76,641.892 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#000000; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
|
|
" 152.27,239.979 2352.76,239.979 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 152.27,1486.45 2352.76,1486.45 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 152.27,1486.45 152.27,47.2441 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 214.547,1486.45 214.547,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 560.536,1486.45 560.536,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 906.524,1486.45 906.524,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 1252.51,1486.45 1252.51,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 1598.5,1486.45 1598.5,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 1944.49,1486.45 1944.49,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 2290.48,1486.45 2290.48,1469.18 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 152.27,1445.72 178.675,1445.72 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 152.27,1043.8 178.675,1043.8 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 152.27,641.892 178.675,641.892 \n",
|
|
" \"/>\n",
|
|
"<polyline clip-path=\"url(#clip7900)\" style=\"stroke:#000000; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 152.27,239.979 178.675,239.979 \n",
|
|
" \"/>\n",
|
|
"<path clip-path=\"url(#clip7900)\" d=\"M 0 0 M214.547 1508.44 Q210.936 1508.44 209.108 1512 Q207.302 1515.55 207.302 1522.67 Q207.302 1529.78 209.108 1533.35 Q210.936 1536.89 214.547 1536.89 Q218.182 1536.89 219.987 1533.35 Q221.816 1529.78 221.816 1522.67 Q221.816 1515.55 219.987 1512 Q218.182 1508.44 214.547 1508.44 M214.547 1504.73 Q220.358 1504.73 223.413 1509.34 Q226.492 1513.92 226.492 1522.67 Q226.492 1531.4 223.413 1536.01 Q220.358 1540.59 214.547 1540.59 Q208.737 1540.59 205.659 1536.01 Q202.603 1531.4 202.603 1522.67 Q202.603 1513.92 205.659 1509.34 Q208.737 1504.73 214.547 1504.73 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M550.918 1535.98 L558.557 1535.98 L558.557 1509.62 L550.247 1511.29 L550.247 1507.03 L558.51 1505.36 L563.186 1505.36 L563.186 1535.98 L570.825 1535.98 L570.825 1539.92 L550.918 1539.92 L550.918 1535.98 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M901.177 1535.98 L917.496 1535.98 L917.496 1539.92 L895.552 1539.92 L895.552 1535.98 Q898.214 1533.23 902.797 1528.6 Q907.404 1523.95 908.584 1522.61 Q910.83 1520.08 911.709 1518.35 Q912.612 1516.59 912.612 1514.9 Q912.612 1512.14 910.668 1510.41 Q908.747 1508.67 905.645 1508.67 Q903.446 1508.67 900.992 1509.43 Q898.561 1510.2 895.784 1511.75 L895.784 1507.03 Q898.608 1505.89 901.061 1505.31 Q903.515 1504.73 905.552 1504.73 Q910.922 1504.73 914.117 1507.42 Q917.311 1510.11 917.311 1514.6 Q917.311 1516.73 916.501 1518.65 Q915.714 1520.54 913.608 1523.14 Q913.029 1523.81 909.927 1527.03 Q906.825 1530.22 901.177 1535.98 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M1256.76 1521.29 Q1260.12 1522 1261.99 1524.27 Q1263.89 1526.54 1263.89 1529.87 Q1263.89 1534.99 1260.37 1537.79 Q1256.85 1540.59 1250.37 1540.59 Q1248.2 1540.59 1245.88 1540.15 Q1243.59 1539.73 1241.14 1538.88 L1241.14 1534.36 Q1243.08 1535.5 1245.39 1536.08 Q1247.71 1536.66 1250.23 1536.66 Q1254.63 1536.66 1256.92 1534.92 Q1259.24 1533.18 1259.24 1529.87 Q1259.24 1526.82 1257.08 1525.11 Q1254.95 1523.37 1251.14 1523.37 L1247.11 1523.37 L1247.11 1519.53 L1251.32 1519.53 Q1254.77 1519.53 1256.6 1518.16 Q1258.43 1516.77 1258.43 1514.18 Q1258.43 1511.52 1256.53 1510.11 Q1254.65 1508.67 1251.14 1508.67 Q1249.21 1508.67 1247.02 1509.09 Q1244.82 1509.5 1242.18 1510.38 L1242.18 1506.22 Q1244.84 1505.48 1247.15 1505.11 Q1249.49 1504.73 1251.55 1504.73 Q1256.88 1504.73 1259.98 1507.17 Q1263.08 1509.57 1263.08 1513.69 Q1263.08 1516.56 1261.44 1518.55 Q1259.79 1520.52 1256.76 1521.29 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M1601.51 1509.43 L1589.7 1527.88 L1601.51 1527.88 L1601.51 1509.43 M1600.28 1505.36 L1606.16 1505.36 L1606.16 1527.88 L1611.09 1527.88 L1611.09 1531.77 L1606.16 1531.77 L1606.16 1539.92 L1601.51 1539.92 L1601.51 1531.77 L1585.91 1531.77 L1585.91 1527.26 L1600.28 1505.36 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M1934.77 1505.36 L1953.12 1505.36 L1953.12 1509.3 L1939.05 1509.3 L1939.05 1517.77 Q1940.07 1517.42 1941.09 1517.26 Q1942.11 1517.07 1943.12 1517.07 Q1948.91 1517.07 1952.29 1520.24 Q1955.67 1523.42 1955.67 1528.83 Q1955.67 1534.41 1952.2 1537.51 Q1948.73 1540.59 1942.41 1540.59 Q1940.23 1540.59 1937.96 1540.22 Q1935.72 1539.85 1933.31 1539.11 L1933.31 1534.41 Q1935.39 1535.54 1937.61 1536.1 Q1939.84 1536.66 1942.31 1536.66 Q1946.32 1536.66 1948.66 1534.55 Q1950.99 1532.44 1950.99 1528.83 Q1950.99 1525.22 1948.66 1523.11 Q1946.32 1521.01 1942.31 1521.01 Q1940.44 1521.01 1938.56 1521.42 Q1936.71 1521.84 1934.77 1522.72 L1934.77 1505.36 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M2290.88 1520.78 Q2287.73 1520.78 2285.88 1522.93 Q2284.05 1525.08 2284.05 1528.83 Q2284.05 1532.56 2285.88 1534.73 Q2287.73 1536.89 2290.88 1536.89 Q2294.03 1536.89 2295.86 1534.73 Q2297.71 1532.56 2297.71 1528.83 Q2297.71 1525.08 2295.86 1522.93 Q2294.03 1520.78 2290.88 1520.78 M2300.17 1506.12 L2300.17 1510.38 Q2298.41 1509.55 2296.6 1509.11 Q2294.82 1508.67 2293.06 1508.67 Q2288.43 1508.67 2285.98 1511.8 Q2283.55 1514.92 2283.2 1521.24 Q2284.56 1519.23 2286.62 1518.16 Q2288.68 1517.07 2291.16 1517.07 Q2296.37 1517.07 2299.38 1520.24 Q2302.41 1523.39 2302.41 1528.83 Q2302.41 1534.16 2299.26 1537.37 Q2296.11 1540.59 2290.88 1540.59 Q2284.89 1540.59 2281.72 1536.01 Q2278.55 1531.4 2278.55 1522.67 Q2278.55 1514.48 2282.43 1509.62 Q2286.32 1504.73 2292.87 1504.73 Q2294.63 1504.73 2296.42 1505.08 Q2298.22 1505.43 2300.17 1506.12 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M63.9875 1448.11 L76.4643 1448.11 L76.4643 1451.91 L63.9875 1451.91 L63.9875 1448.11 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M82.3439 1459.06 L89.9827 1459.06 L89.9827 1432.69 L81.6726 1434.36 L81.6726 1430.1 L89.9364 1428.44 L94.6123 1428.44 L94.6123 1459.06 L102.251 1459.06 L102.251 1463 L82.3439 1463 L82.3439 1459.06 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M107.367 1428.44 L125.723 1428.44 L125.723 1432.37 L111.649 1432.37 L111.649 1440.84 Q112.668 1440.5 113.686 1440.33 Q114.705 1440.15 115.723 1440.15 Q121.51 1440.15 124.89 1443.32 Q128.27 1446.49 128.27 1451.91 Q128.27 1457.49 124.797 1460.59 Q121.325 1463.67 115.006 1463.67 Q112.83 1463.67 110.561 1463.3 Q108.316 1462.93 105.909 1462.19 L105.909 1457.49 Q107.992 1458.62 110.214 1459.18 Q112.436 1459.73 114.913 1459.73 Q118.918 1459.73 121.256 1457.63 Q123.594 1455.52 123.594 1451.91 Q123.594 1448.3 121.256 1446.19 Q118.918 1444.08 114.913 1444.08 Q113.038 1444.08 111.163 1444.5 Q109.311 1444.92 107.367 1445.8 L107.367 1428.44 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M62.9921 1046.2 L75.4689 1046.2 L75.4689 1050 L62.9921 1050 L62.9921 1046.2 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M81.3485 1057.15 L88.9874 1057.15 L88.9874 1030.78 L80.6772 1032.45 L80.6772 1028.19 L88.9411 1026.52 L93.617 1026.52 L93.617 1057.15 L101.256 1057.15 L101.256 1061.08 L81.3485 1061.08 L81.3485 1057.15 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M116.325 1029.6 Q112.714 1029.6 110.885 1033.17 Q109.08 1036.71 109.08 1043.84 Q109.08 1050.94 110.885 1054.51 Q112.714 1058.05 116.325 1058.05 Q119.959 1058.05 121.765 1054.51 Q123.594 1050.94 123.594 1043.84 Q123.594 1036.71 121.765 1033.17 Q119.959 1029.6 116.325 1029.6 M116.325 1025.9 Q122.135 1025.9 125.191 1030.51 Q128.27 1035.09 128.27 1043.84 Q128.27 1052.57 125.191 1057.17 Q122.135 1061.75 116.325 1061.75 Q110.515 1061.75 107.436 1057.17 Q104.381 1052.57 104.381 1043.84 Q104.381 1035.09 107.436 1030.51 Q110.515 1025.9 116.325 1025.9 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M89.7744 644.287 L102.251 644.287 L102.251 648.084 L89.7744 648.084 L89.7744 644.287 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M107.367 624.612 L125.723 624.612 L125.723 628.547 L111.649 628.547 L111.649 637.019 Q112.668 636.672 113.686 636.51 Q114.705 636.324 115.723 636.324 Q121.51 636.324 124.89 639.496 Q128.27 642.667 128.27 648.084 Q128.27 653.662 124.797 656.764 Q121.325 659.843 115.006 659.843 Q112.83 659.843 110.561 659.472 Q108.316 659.102 105.909 658.361 L105.909 653.662 Q107.992 654.797 110.214 655.352 Q112.436 655.908 114.913 655.908 Q118.918 655.908 121.256 653.801 Q123.594 651.695 123.594 648.084 Q123.594 644.473 121.256 642.366 Q118.918 640.26 114.913 640.26 Q113.038 640.26 111.163 640.676 Q109.311 641.093 107.367 641.973 L107.367 624.612 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip7900)\" d=\"M 0 0 M116.325 225.778 Q112.714 225.778 110.885 229.343 Q109.08 232.885 109.08 240.014 Q109.08 247.121 110.885 250.685 Q112.714 254.227 116.325 254.227 Q119.959 254.227 121.765 250.685 Q123.594 247.121 123.594 240.014 Q123.594 232.885 121.765 229.343 Q119.959 225.778 116.325 225.778 M116.325 222.074 Q122.135 222.074 125.191 226.681 Q128.27 231.264 128.27 240.014 Q128.27 248.741 125.191 253.347 Q122.135 257.931 116.325 257.931 Q110.515 257.931 107.436 253.347 Q104.381 248.741 104.381 240.014 Q104.381 231.264 107.436 226.681 Q110.515 222.074 116.325 222.074 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><circle clip-path=\"url(#clip7902)\" cx=\"258.419\" cy=\"371.943\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"387.995\" cy=\"318.569\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"743.222\" cy=\"197.561\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"802.77\" cy=\"102.403\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"903.927\" cy=\"87.9763\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"1150.82\" cy=\"277.231\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"1250.76\" cy=\"275.634\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"1422.69\" cy=\"342.481\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"1425.92\" cy=\"295.483\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"1757.63\" cy=\"683.379\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"1922.68\" cy=\"722.411\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"1952.55\" cy=\"912.312\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"1959.14\" cy=\"876.968\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"2120.04\" cy=\"1106.09\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<circle clip-path=\"url(#clip7902)\" cx=\"2141.24\" cy=\"1117.53\" r=\"14\" fill=\"#009af9\" fill-rule=\"evenodd\" fill-opacity=\"1\" stroke=\"#000000\" stroke-opacity=\"1\" stroke-width=\"3.2\"/>\n",
|
|
"<polyline clip-path=\"url(#clip7902)\" style=\"stroke:#e26f46; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
|
|
" 214.547,481.127 387.542,340.457 560.536,239.979 733.53,179.693 906.524,159.597 1079.52,179.693 1252.51,239.979 1425.51,340.457 1598.5,481.127 1771.5,661.987 \n",
|
|
" 1944.49,883.039 2117.48,1144.28 2290.48,1445.72 \n",
|
|
" \"/>\n",
|
|
"</svg>\n"
|
|
]
|
|
},
|
|
"execution_count": 9,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"# More plot!() tries.\n",
|
|
"rangez = 0:0.5:6\n",
|
|
"a,b,c = -1,4,-3\n",
|
|
"\n",
|
|
"f = Array{Float64}(undef,length(rangez))\n",
|
|
"\n",
|
|
"# Plot the function parabfit, for x values between -5 and 5 \n",
|
|
"i = 1\n",
|
|
"for j = rangez\n",
|
|
" f[i] = parabfit(j) \n",
|
|
" i = i + 1\n",
|
|
"end\n",
|
|
"plot(x,y,line=:scatter,legend=:false)\n",
|
|
"plot!(rangez,f)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Julia 1.2.0",
|
|
"language": "julia",
|
|
"name": "julia-1.2"
|
|
},
|
|
"language_info": {
|
|
"file_extension": ".jl",
|
|
"mimetype": "application/julia",
|
|
"name": "julia",
|
|
"version": "1.2.0"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|