Difference between revisions of "Length of a curve using numerical methods"
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Simpson's Rule is used to calculate integrals numerically. | + | Simpson's Rule is one of many methods used to calculate integrals numerically. |
From the [[Length of a curve|Length of curve page]], the length can be calculated using the integral: <font size = "+2"><span>∫</span></font>sqr(1+f '(x)<sup>2</sup>)dx | From the [[Length of a curve|Length of curve page]], the length can be calculated using the integral: <font size = "+2"><span>∫</span></font>sqr(1+f '(x)<sup>2</sup>)dx | ||
Line 5: | Line 5: | ||
--- | --- | ||
− | Instead of evaluating | + | Instead of evaluating integrals with a table, a numerical method called Simpson's rule can be used: |
− | the length of the curve after n iterations = L<sub>n</sub> = (<span>Δ</span>x/3)(f(x<sub>0</sub>) + 4f(x<sub>1</sub>) + 2f(x<sub>2</sub>) + 4f(x<sub>3</sub>) + 2f(x<sub>4</sub>) + ...+ 2f(x<sub>n-2</sub>) + 4f(x<sub>n-1</sub>) + f(x<sub> | + | the length of the curve after n iterations = L<sub>n</sub> = (<span>Δ</span>x/3)(f(x<sub>0</sub>) + 4f(x<sub>1</sub>) + 2f(x<sub>2</sub>) + 4f(x<sub>3</sub>) + 2f(x<sub>4</sub>) + ...+ 2f(x<sub>n-2</sub>) + 4f(x<sub>n-1</sub>) + f(x<sub>n</sub>)) |
where <span>Δ</span>x = (b-a)/n with a and b being the boundaries and n the number of iterations of the calculation. | where <span>Δ</span>x = (b-a)/n with a and b being the boundaries and n the number of iterations of the calculation. | ||
Line 13: | Line 13: | ||
--- | --- | ||
− | The length of curve equation used in the example was <font size = "+2"><span>∫</span></font>sqr(1+(30e<sup>−0.3t</sup>)<sup>2</sup>)dt | + | The length of curve equation used in the heating liquid example was <font size = "+2"><span>∫</span></font>sqr(1+(30e<sup>−0.3t</sup>)<sup>2</sup>)dt |
using boundary conditions of 0 and 5 minutes, and using 10 iterations, the problem becomes: | using boundary conditions of 0 and 5 minutes, and using 10 iterations, the problem becomes: | ||
− | <span>Δ</span> | + | g(t) = sqr(1+(30e<sup>−0.3t</sup>)<sup>2</sup> |
+ | |||
+ | <span>Δ</span>t = (5-0)/10 = 1/2 | ||
+ | |||
the subintervals are {0, 1/2, 1, 3/2, 2, 5/2, 3, 7/2, 4, 9/2, 5} | the subintervals are {0, 1/2, 1, 3/2, 2, 5/2, 3, 7/2, 4, 9/2, 5} | ||
− | and the answer is thus = (1/6)( | + | and the answer is thus = (1/6)(g(0) + 4g(1/2) + 2g(1) + 4g(3/2) + 2g(2) + 4g(5/2) + 2g(3) + 4g(7/2) + 2g(4) + 4g(9/2) + g(5)) a great resource for doing these calculations is [https://www.symbolab.com/solver/function-arithmetic-composition-calculator/f%5Cleft(x%5Cright)%3D%5Csqrt%7B%5Cleft(1%2B%5Cleft(30e%5E%7B-0.3x%7D%5Cright)%5E%7B2%7D%5Cright)%7D%2C%20f%5Cleft(5%5Cright) here] |
+ | |||
+ | = (1/6)(1 + 4*25.84 + 2*22.247 + 4*19.155 + 2*16.495 + 4*14.206 + 2*12.238 + 4*10.546 + 2*9.091 + 4*7.841 + 6.768) | ||
+ | |||
+ | = (1/6)(1 + 103.36 + 44.494 + 76.62 + 32.99 + 56.824 + 24.476 + 42.184 + 18.182 + 31.364 + 6.768) | ||
+ | |||
+ | = (1/6)(438.262) | ||
+ | |||
+ | = 73 degrees | ||
+ | |||
+ | which is very close to the number obtained using integral tables (77 degrees). The value will get closer as the number of iterations is increased, which can easily be done using a computer. |
Latest revision as of 20:45, 1 April 2021
Simpson's Rule is one of many methods used to calculate integrals numerically.
From the Length of curve page, the length can be calculated using the integral: ∫sqr(1+f '(x)2)dx
---
Instead of evaluating integrals with a table, a numerical method called Simpson's rule can be used:
the length of the curve after n iterations = Ln = (Δx/3)(f(x0) + 4f(x1) + 2f(x2) + 4f(x3) + 2f(x4) + ...+ 2f(xn-2) + 4f(xn-1) + f(xn))
where Δx = (b-a)/n with a and b being the boundaries and n the number of iterations of the calculation.
---
The length of curve equation used in the heating liquid example was ∫sqr(1+(30e−0.3t)2)dt
using boundary conditions of 0 and 5 minutes, and using 10 iterations, the problem becomes:
g(t) = sqr(1+(30e−0.3t)2
Δt = (5-0)/10 = 1/2
the subintervals are {0, 1/2, 1, 3/2, 2, 5/2, 3, 7/2, 4, 9/2, 5}
and the answer is thus = (1/6)(g(0) + 4g(1/2) + 2g(1) + 4g(3/2) + 2g(2) + 4g(5/2) + 2g(3) + 4g(7/2) + 2g(4) + 4g(9/2) + g(5)) a great resource for doing these calculations is here
= (1/6)(1 + 4*25.84 + 2*22.247 + 4*19.155 + 2*16.495 + 4*14.206 + 2*12.238 + 4*10.546 + 2*9.091 + 4*7.841 + 6.768)
= (1/6)(1 + 103.36 + 44.494 + 76.62 + 32.99 + 56.824 + 24.476 + 42.184 + 18.182 + 31.364 + 6.768)
= (1/6)(438.262)
= 73 degrees
which is very close to the number obtained using integral tables (77 degrees). The value will get closer as the number of iterations is increased, which can easily be done using a computer.