#P4525. Definite Integral of a Rational Function
Definite Integral of a Rational Function
Definite Integral of a Rational Function
Given six numbers: a, b, c, d, L, and R, compute the definite integral:
$$\int_{L}^{R}\frac{cx+d}{ax+b}\,dx$$
Round the result to 6 decimal places. It is guaranteed that during the calculation the denominator ax+b is never 0 and the integral converges. When a ≠ 0 you may use the following antiderivative formula:
$$F(x)=\frac{c}{a}x+\frac{d-\frac{c\,b}{a}}{a}\ln|ax+b|+C$$
If a = 0, the integrand becomes a linear function and should be integrated directly.
inputFormat
The input consists of a single line with 6 space-separated numbers: a b c d L R.
outputFormat
Output the value of the integral computed to 6 decimal places.
sample
1 0 1 0 0 1
1.000000