Determine continuous function from piecewise derivative I'm having trouble solving this issue.

Determine a continuous function $f$ on the interval $[-2,2]$ whose derived function on $[-2,2] \setminus \{0\}$ is known to be the function:
$$
f(x)=
\left\lbrace
\begin{array}{lll}
\dfrac{x^2+4x+7}{2x^3-x^2+18x-9} & \text{ if} -2 \leq x < 0 \\ 
& \\
x^2 \sin^2 (x) & \text{ if } 0 < x \leq 2
\end{array}
\right.
$$

I tried to calculate the integral of the function in each definition interval, add a constant and impose conditions to determine the constant. I have the problem in the first interval. I can't integrate the function. How do I solve this problem? Thanks!
 A: You can use partial fractions. First, factorize the denominator as $$2x^3-x^2+18x-9 = (2x-1)(x^2+9) = (2x-1)(x+3i)(x-3i) $$ Now, set $$\frac{x^2+4x+7}{(2x-1)(x-3i)(x+3i)} = \frac{P}{2x-1} + \frac{Q}{x+3i} +\frac{R}{x-3i} \\ \implies  x^2+4x+7 = P(x^2+9) +Q(2x-1)(x-3i) +R(2x-1)(x+3i)$$
Letting $x=\frac 12, 3i, -3i$ will give you $P=1, Q=\frac i3, R= -\frac i3 $. Hence, the integral is $$\int \frac{dx}{2x-1} +\frac i3 \int \frac{dx}{x+3i} -\frac i3 \int \frac{dx}{x-3i} \\ =\ln|2x-1| +\frac i3 \ln(x+3i) -\frac i3 \ln(x-3i) + C \\ =\ln(1-2x) +\frac i3  \left[ \ln \sqrt{x^2+9} +i(\pi +\tan^{-1} \frac 3x) \right] -\frac i3 \left[ \ln\sqrt{x^2+9} +i(-\pi -\tan^{-1}\frac 3x ) \right] + C \hspace{0.1 cm} (*) \\ = \ln(1-2x)-\frac 23 (\pi+\tan^{-1} \frac 3x ) + C \\ = \ln(1-2x)-\frac 23 \tan^{-1} \frac 3x +C’$$
$ \begin{align} (*) \ln(z) = \ln |z| +i\arg z \end{align}$
A: Thank you very much for your responses.
So in summary, the $f$ function has the form:
$$
f(x)=
\left\lbrace
\begin{array}{ll}
\dfrac{1}{2} \ln | 2x-1 | 
+ \dfrac{2}{3} \arctan (x/3) + C & \text{ if } -2 \leq x < 0  \\
& \\
\dfrac{x^3}{6}  - \dfrac{x^2}{4} \sin (2x) 
- \dfrac{x}{4} \cos (2x) + \dfrac{1}{8} \sin (2x) + D 
 & \text{ if } 0< x \leq 2  \\
\end{array}
\right.
$$
To impose that $f$ be continuous at $x=0$, we impose that the
lateral limits are equal:
$$
f(0^+) = f(0^-) \Rightarrow C=D
$$
So any constants $ C = D $ are solution to the problem ?? That's right ??
Thank you!
