Assume I have following two equations:
$f(x) = a_1 x^4 + b_1 x^3 + c_1 x^2 + d_1 x + e_1$
$g(x) = a_2 x^4 + b_2 x^3 + c_2 x^2 + d_2 x + e_2$
Can I calculate $\int_{-5}^5 |f(x) - g(x)| dx$ using coefficients?
Assume I have following two equations:
$f(x) = a_1 x^4 + b_1 x^3 + c_1 x^2 + d_1 x + e_1$
$g(x) = a_2 x^4 + b_2 x^3 + c_2 x^2 + d_2 x + e_2$
Can I calculate $\int_{-5}^5 |f(x) - g(x)| dx$ using coefficients?
Copyright © 2021 JogjaFile Inc.
In general, if you want to compute $\int_a^b|f(x)-g(x)|\,dx$, you need to know at least something about where $f(x)-g(x)\geq0$ so you can split the integral over several intervals via the absolute value. This can be tricky with a general quartic equation. You need to know something about the roots of the resulting quartic polynomial $p\equiv f-g$ in order to determine where $f(x)-g(x)$ is nonnegative. The roots are expressible in closed-form, but calculations in general would probably be messy.
For given $(a_1,a_2,\ldots,e_1,e_2)$, this may turn out to be easier. For example, with $f(x)=x^4+1$, $g(x)=x^2+1$, $f(x)-g(x)=x^4-x^2=x^2(x^2-1)=x^2(x+1)(x-1)$. Say we want to compute the area between $f$ and $g$ on $[-1,1]$. From some analysis with the derivatives or otherwise, you can check that this function is negative on $[-1,1]$, so: $$\int_{-1}^1\big|f(x)-g(x)\big|\,dx=\int_{-1}^1 x^4-x^2\,dx=2\left(\frac{1}{5}-\frac{1}{3}\right)=-\frac{4}{15}$$
Of course, with numerical calculations, the general integral is trivial.