To find the expected value for $f(x)=a x\sin(x) e^{-x}$ for $0<x<\infty$ 0 otherwise would I have to do the following since $E(x)=u_x$
$E(X)=\int x f(x)dx$ so would I have to compute $\int_{0}^{\infty}2x^2\sin(x)e^{-x}$ to find the expected value.
To find the expected value for $f(x)=a x\sin(x) e^{-x}$ for $0<x<\infty$ 0 otherwise would I have to do the following since $E(x)=u_x$
$E(X)=\int x f(x)dx$ so would I have to compute $\int_{0}^{\infty}2x^2\sin(x)e^{-x}$ to find the expected value.
To provide an "answer" to my comment above:
The "density" $f_X(x) = 2 x\sin(x) e^{-x}$ for $x\geq 0$ cannot be a true density because it is negative over certain intervals. It would give $P[X \in [4,5]] = \int_4^5 2x \sin(x)e^{-x}dx < 0$ which does not make sense. So this is likely a mistake in the question.
However, it is correct that $\int_0^{\infty} 2x \sin(x) e^{-x}dx = 1$ (and so the $a$ constant needed to ensure the integral is 1 is indeed $a=2$). The general computation $E[X] = \int_{-\infty}^{\infty} xf_X(x)dx$ would be correct if this density $f_X(x)$ made sense.