  We study numerical integration by combining the trapezoidal rule with a
M\"obius transformation that maps the unit circle onto the real line. We prove
that the resulting transformed trapezoidal rule attains the optimal rate of
convergence if the integrand function lives in a weighted Sobolev space with a
weight that is only assumed to be a positive Schwartz function decaying
monotonically to zero close to infinity. Our algorithm only requires the
ability to evaluate the weight at the selected nodes, and it does not require
sampling from a probability measure defined by the weight nor information on
its derivatives. In particular, we show that the M\"obius transformation, as a
change of variables between the real line and the unit circle, sends a function
in the weighted Sobolev space to a periodic Sobolev space with the same
smoothness. Since there are various results available for integrating and
approximating periodic functions, we also describe several extensions of the
M\"obius-transformed trapezoidal rule, including function approximation via
trigonometric interpolation, integration with randomized algorithms, and
multivariate integration.
