In order to make text flushed both left and right, latex adjusts the distance between words, and to a lesser extent, the distance between characters within a word. This is good, however it also adjusts the spacing within mathematical formulae. I don't like this feature - can I reduce its effect, or perhaps turn it off completely?
2 Answers
You would have to modify the length registers that allow for stretch/shrink around math operators/relations, namely \medmuskip and \thickmuskip. Their defaults are 4.0mu plus 2.0mu minus 4.0mu and 5.0mu plus 5.0mu. So adding
\setlength{\medmuskip}{1\medmuskip}% Formerly 4.0mu plus 2.0mu minus 4.0mu -> 4.0mu
\setlength{\thickmuskip}{1\thickmuskip}% Formerly 5.0mu plus 5.0mu -> 5.0mu
should work by stripping the glue. For more on math spacing around operators, see How to change default for spacing around binary relations?
Here's a small example:

\documentclass{article}
\begin{document}
Here is some text with an equation in it: $f(x)=x^2+3x_0\cdot\sin x$
and the textual content continues into the second line. No other math
content is contained within this paragraph.
%\thinmuskip=3.0mu (without glue)
\setlength{\medmuskip}{1\medmuskip}% Formerly 4.0mu plus 2.0mu minus 4.0mu -> 4.0mu
\setlength{\thickmuskip}{1\thickmuskip}% Formerly 5.0mu plus 5.0mu -> 5.0mu
Here is some text with an equation in it: $f(x)=x^2+3x_0\cdot\sin x$
and the textual content continues into the second line. No other math
content is contained within this paragraph.
\end{document}
Since \thinmuskip is already void of glue, no further modifications is required. For a motivation of where these lengths are used, see the mathmode documentation (section 11 Space, subsection 11.1 Math typesetting, p 28).
muskips are not supported by calc, alternate calculations techniques (using plain TeX) are required to manipulate these lengths.
As an alternative to resetting the parameters it is sometimes more convenient to box the expression so it is set to natural width, either with an explicit box, or within the math, just using {}.

Note the math only stretched on the second row in this plain tex example.
X\hbox{words here $a + b$ and here}X
X\hbox spread 1cm{words here $a + b$ and here}X
X\hbox spread 1cm{words here \hbox{$a + b$} and here}X
X\hbox spread 1cm{words here ${a + b}$ and here}X
\bye
- 757,742
\setlengthshould not be used, because muskips are not supported by package calc. Also there is no need for magic numbers,\medmuskip=1\medmuskipand\thickmuskip=1\thickmuskipwill do. – Heiko Oberdiek Nov 22 '12 at 08:29\medmuskip=1\medmuskipleaves the natural length of\medmuskipthe same but keeps it from stretching or shrinking is mentioned on page 100 of Lamport's LaTeX 2e manual: "Multiplying a length command by a number destroys its elasticity, producing a rigid length." I thought I'd mention this because I'm not sure how common the knowledge of this trick is. – MSC Jun 04 '14 at 19:52mathmodedocumentation is dead. – polynomial_donut Jun 13 '17 at 14:36