Testwiki:Reference desk/Archives/Mathematics/2022 December 15

From testwiki
Revision as of 07:51, 24 December 2022 by imported>Scsbot (edited by robot: archiving December 15)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Error:not substituted

{| width = "100%"

|- ! colspan="3" align="center" | Mathematics desk |- ! width="20%" align="left" | < December 14 ! width="25%" align="center"|<< Nov | December | Jan >> ! width="20%" align="right" |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.


December 15

Approximating y = e^x

I want to approximate y = e^x in the range x = a to x = c with two line segments (a, e^a) (b, e^b) and (b, e^b) (c, e^c) such that the error defined as the area between the original y = e^x and the two segments is minimised. All I really care about is the ratio (b - a) / (c - a).

I'm pretty sure I could do this by finding an expression for the area, taking the derivative, setting it to zero and solving for x to find b, but it feels like the solution shouldn't depend on a or b or even e, so all of that seems like it might be overkill.

Is there an obvious answer that I'm missing?

2A01:E34:EF5E:4640:4210:3448:E6A9:8778 (talk) 22:03, 15 December 2022 (UTC)

If you increase a and c together while keeping (c-a) fixed, say a -> a+d and c -> c+d, that just scales the areas up by a multiplicative factor of e^d. Therefore, the quantities (b-a) and (c-b) only depend on (c-a). We can say b = a + f(c-a) where f is some function. Perhaps that's the "shouldn't depend" that you're intuiting? Given that observation, you can simplify the calculation by setting a=0, then work out the answer just as you suggested. --Amble (talk) 00:13, 16 December 2022 (UTC)
Hi! The only direct thing comes to my mind is Taylor series expansion. However, I am not sure regarding the ratio part of the question. Are you trying to say ration between area under curve in both line segments (?). If so, I would highly recommend to work out on paper and see if this is something you want. I hope this helps! :) Cheers, Nanosci (talk) 00:17, 16 December 2022 (UTC)
The Leibniz integral rule is simple here because the integrands are zero at x=b. I get:
0=b(ab((bx)ea+(xa)ebbaex)x+bc((cx)eb+(xb)eccbex)x)=ab(b((bx)ea+(xa)ebbaex))x+bc(b((cx)eb+(xb)eccbex))x=ea+eb(ca)ec2
so
b=ln(eceaca)
catslash (talk) 01:10, 16 December 2022 (UTC)
Try a=0, c=1, then b=ln(e1)0.541325 which seems plausible. catslash (talk) 01:30, 16 December 2022 (UTC)
On further consideration, for any function f(x), the area is stationary when
f(b)=f(c)f(a)ca
that is, the point at which the slope of the function is the average slope over the interval. catslash (talk) 02:32, 16 December 2022 (UTC)
I think this is correct. Here is another way of obtaining the result. By scaling we can choose a=0,c=1. The piecewise linear function fb on the interval [0,1] fixed by the three points (0,1),(b,eb),(1,e) never assumes values exceeding those of y=ex, so to minimize the difference in areas we can simply seek to maximize the area between fb and the x-axis, formed by two trapezoids glued back-to-back:
Ib=01fb(x)dx=12b(1+eb)+12(1b)(eb+e).
Solving ddbIb=0 results in b=log(e1).  --Lambiam 07:21, 16 December 2022 (UTC)
Thankyou all. So as I suspected a and b are not relevant, but e actually is. I had the feeling that the base would end up canceling out and the ratio would end up being a common constant such as 0.5 or the golden ratio or something. 08:34, 16 December 2022 (UTC) — Preceding unsigned comment added by 2A01:E34:EF5E:4640:6743:DBBA:BC3:542 (talk)
Knowing the answer from having ground through the integrals, hindsight makes it obvious geometrically:
  • The area between the line segments and the curve is the area under the line segments minus the area under the curve.
  • The area under the curve is fixed, so the problem reduces to minimizing the area under the line segments (subject to the middle point being on the curve)
  • That is equivalent to maximizing the area of a triangle whose (upward facing) 'base' is a single straight line between the end points and whose 'apex' is the middle point (b, f(b)) of the line segment pair.
  • The area of a triangle is half the base times the height, so the area is stationary (and possibly maximal) when the apex is moving parallel to the base.
  • So the solution lies at a point where the slope of the curve is equal to the average slope over the interval.
catslash (talk) 19:23, 16 December 2022 (UTC)