Wikipedia:Reference desk/Archives/Mathematics/2024 April 13
Appearance
Mathematics desk | ||
---|---|---|
< April 12 | << Mar | April | May >> | Current desk > |
Welcome to the Wikipedia Mathematics Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
April 13
[edit]How to calculate a line integral by computer?
[edit]Hi!
There is a line integral ∫L yds, where L is y2=2x and from (1/2, -1) to (2, 2). My answer is (5√5−2√2)/3, but L is a quadratic curve (instead of a line) and the answer seems odd, therefore I am not sure my calculation is correct or not.
How can I calculate a line integral result by computer (by Wolfram Alpha, python etc.)? James King 2009 (talk) 11:49, 13 April 2024 (UTC)
- Swapping and , this is the arc length of the segment of the parabola given by the equation from to . It can be turned into an ordinary integral of the form
- In view of the square root in this formula, the appearance in the result should not be odd, but I find a different result, involving not only square roots but also logarithms (or arcsines). Obviously, the length of the arc should exceed that of the straight line segment connecting the end points, which is but your result evaluates numerically to less than To check your result: its numerical value should be close to --Lambiam 14:19, 13 April 2024 (UTC)
- The question calls for the integral of yds, so the first moment wrt the x-axis, not arc length. So basically you're integrating . --RDBury (talk) 15:37, 13 April 2024 (UTC)
- PS. if you just want a ballpark estimate to check your result, break the curve up and approximate by line segments. In this case the section from y=-1 to y=1 cancels itself out, so you really just have to do the segment from (1/2, 1) to (2, 2). If you replace the curve with a line segment, its center of mass is the midpoint, so (5/4, 3/2). The length is √13/2, so the moment is (3/2)(√13/2) ≈ 2.7. That's off from the original result by about .1 so I'd count it as verified. --RDBury (talk) 15:54, 13 April 2024 (UTC)
- Symbolic integration by Maxima confirms it as well. --Lambiam 20:54, 13 April 2024 (UTC)
- Actually I should try that out, so thanks. There are limits to what you can do with pencil & paper (and maybe a calculator). I've found you can do wonders with an off-the-shelf spreadsheet program, and if you already know how to use one that would work as well. As with many things, the trade-off is the time it takes to learn how to use the tool in question. You can write a Python program when the task is too complex for a spreadsheet, but if you don't know Python already that's a lot of effort for solving one problem. The OP mentioned Wolfram Alpha as well, and I assume that would tell you the answer too if you know the right input string. I use Alpha occasionally, but mostly for things where the right command is obvious, "solve x^3-x-1=0" for example. --RDBury (talk) 02:17, 14 April 2024 (UTC)
- For this specific integral it isn't too hard to do the integration purely mentally by change of variables so and thus --Lambiam 10:09, 14 April 2024 (UTC)
- Actually I should try that out, so thanks. There are limits to what you can do with pencil & paper (and maybe a calculator). I've found you can do wonders with an off-the-shelf spreadsheet program, and if you already know how to use one that would work as well. As with many things, the trade-off is the time it takes to learn how to use the tool in question. You can write a Python program when the task is too complex for a spreadsheet, but if you don't know Python already that's a lot of effort for solving one problem. The OP mentioned Wolfram Alpha as well, and I assume that would tell you the answer too if you know the right input string. I use Alpha occasionally, but mostly for things where the right command is obvious, "solve x^3-x-1=0" for example. --RDBury (talk) 02:17, 14 April 2024 (UTC)
- Symbolic integration by Maxima confirms it as well. --Lambiam 20:54, 13 April 2024 (UTC)