Difference of sampling and calculating probability distribution function.

24 Views Asked by At

I have basic question with sampling from a probability distribution. For instance in Importance Sampling, it's hard to sample from $p$ directly, so we sample from the proposal distribution $q$ then calculate $\frac{p(x_i)}{q(x_i)}$. But in the end, it is necessary to calculate $p(x_i)$. Is it impossible to sample from $p$ although we know the function of $p$? What is difference?