Background:
For two continuous random variables, $X$ and $Y$, the density of $Z := \frac{X}{Y}$ is given by \begin{equation} p_Z(z) = \int_{-\infty}^\infty \lvert y\rvert\, p_{XY}(zy, y) \, \text{d}y, \end{equation} where $p_{XY}(x, y)$ is the joint density of $X$ and $Y$ (see ratio distribution and joint density).
Question:
My question is about the computation of this density:
How can I compute $p_Z(z_i)$ if I am given values of the joint density at discrete points, $p_{XY}(x_i, y_i)$?
Additional thoughts:
Let's say, for simplicity, that the $x_i$'s and $y_i$'s are equally spaced and take on the same values. That is $x_i = y_i = a_{\text{min}} + ih$ (for some minimum value $a_\text{min}$) and we store the joint density in a matrix $M^{XY}$, where $M^{XY}_{ij} = p_{XY}(x_i, y_i)$.
If I wanted to compute, say, $p_Z(1)$, then I have
\begin{equation} p_Z(1) = \int_{-\infty}^\infty \lvert y\rvert\, p_{XY}(y, y) \, \text{d}y, \end{equation} so I would use the leading diagonal of the matrix (i.e. where $x=y$) to get $p_{XY}(y_i, y_i)$ and then integrate using some numerical scheme. But what if I want to compute other values, say $p_Z(0.8)$ or $p_Z(1.5)$? Now it is not clear to me.
Any advice would be appreciated. Thanks.