Approximate $f(x) = \frac{1}{x}$ using $e^x, \sin(x)$ and $\Gamma(x)$

63 Views Asked by At

My task is to approximate $f(x) = \frac{1}{x}$ using a linear combination of $e^x, \sin(x)$ and $\Gamma(x)$ in the interval [1, 2] with a step width of 0.01. How is this possible?

1

There are 1 best solutions below

0
On

You should probably consider interpolation as the easiest way to approximate f with the three functions.

You are looking at the coefficients $\alpha$, $\beta$ and $\gamma$ such that $f(x) \approx \alpha \exp(x) + \beta \sin(x) + \gamma \Gamma(x)$. Use three points of the domain (e.g. $x1=1$, $x_2=1.5$ and $x_3=2$) in which you want $f$ to exactly match with its approximation. This gives you three linear equations for $\alpha$, $\beta$ and $\gamma$. Just solve the system, and you got the approximation (you should find $\alpha \approx -0.1072$, $\beta \approx 0.0105$ and $\gamma \approx 1.2826$).

Interpolation is easy but might not perform very well in some cases. But in this case, the fit is... impressive. It is hard to distinguish the function and its approximation.

Hope it helps!