Suppose I was integrating some function $\displaystyle f(x)$ across the interval [a,d].

Suppose, though, that this function was a piecewise function defined as follows:

$\displaystyle f(x) = \left\{

\begin{array}{c l}

ug(x) & a \leq x \leq b \\

vg(x) & b \leq x \leq c

\end{array}

\right.

$

Where u and v are some constants.

So the integral looks something like this:

$\displaystyle I = \int_a^b u \, g(x) dx + \int_b^c v g(x) \,dx $

$\displaystyle = u\int_a^b \, g(x) dx + v\int_b^c g(x) \,dx$

Is there some way to express this as a single integral across the whole interval [a,c]?

I tried equating my general integral to $\displaystyle w\int_a^c g(x) \, dx $ and solved for w, but the answer would require that I'd have to compute the individiual integrals first before I could combine them. Which makes it rather pointless.

The reason I ask is that I'm integrating some pretty big, nasty functions, and it would save me a lot of time under exam conditions if I didn't have to write each integral out twice - it seems to me to be a perfect waste of time when they're both the same function being integrated over adjacent intervals!