HP42s first major program (Double Integral) Best way to approach?
|
05-27-2020, 05:23 PM
(This post was last modified: 05-30-2020 02:24 PM by Albert Chan.)
Post: #13
|
|||
|
|||
RE: HP42s first major program (Double Integral) Best way to approach?
(05-27-2020 06:15 AM)Werner Wrote: Then the inner integral becomes Continued on, we have \(I = \int_a^b\int_0^c\frac{r\sqrt{c^2-x^2}}{\sqrt{r^2-x^2}}\;dx\;dr = \int _0 ^c \sqrt{c^2-x^2}\left( \sqrt{b^2-x^2} - \sqrt{a^2-x^2} \right)\;dx\) The shape look like an ellipse, with semi-axis, c, c*(b-a) a, b, c = 24, 29, 12 I ≈ pi/4 * (b-a) * c^2 ≈ 565.4866776461628 If integrand can be transformed to bell-shape, integral is easy to integrate. see https://www.hpmuseum.org/forum/thread-13...#pid127590 Let \(x = c \cos(t)\; → dx = -c \sin(t)\;dt\) \(I = \int _0 ^{\pi /2} (c^2-x^2) \left( \sqrt{b^2-x^2} - \sqrt{a^2-x^2}\right)\;dt \) Shape of transformed curve: https://www.wolframalpha.com/input/?i=pl...0+to+pi%29 Code: function I(a,b,c, n) -- n = number of trapezoids Convergence with trapezoid rule is amazingly fast: lua> a, b, c = 24, 29, 12 lua> for n=1,8 do print(n, I(a,b,c, n)) end 1 565.4866776461628 2 581.3714770410786 3 581.40570463529 4 581.405804245352 5 581.4058045759407 6 581.4058045771336 7 581.4058045771384 8 581.4058045771384 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 25 Guest(s)