I'm trying to teach myself calculus of variations when I came across a worked example about the shortest distance between two points in a plane. This is a question about the mathematics but I don't think it belongs in Mathematics stack exchange because it's about techniques utilized by physicists.
The worked example starts off by defining a distance function like this:
$$\mathrm ds = \sqrt{\mathrm dx^2 +\mathrm dy^2}$$
So here $\mathrm ds, \mathrm dx,$ and $\mathrm dy$ are being treated as if they are real (as in actual) numbers that have some real value when they are, in the best case, infinitesimals. The way I understand them is that they either define an operation on a function, such as $\frac{d}{\mathrm dx}$, or the derivative of a function that's been acted on by the differential operator, eg. $\frac{\mathrm dy}{\mathrm dx}$. They're just notation for operations.
$\frac{\mathrm dy}{\mathrm dx}$ is not a ratio of two numbers. They're not numbers as far as I can understand, they represent operations.
The worked example then pulls out a $\mathrm dx$ from under the square root, as if it is a number, to get this
$$\mathrm ds = \sqrt{1 +\left(\frac{\mathrm dy}{\mathrm dx}\right)^2} \mathrm dx$$
Then it does this
$$\int \mathrm ds = \int \sqrt{1 +\left(\frac{\mathrm dy}{\mathrm dx}\right)^2} \mathrm dx$$
it's gone back to treating $\mathrm dx$ and $\frac{\mathrm dy}{\mathrm dx}$ as operators or functions resulting from operations respectively.
My question is, how do you justify when to switch between treating it as a number and an operation? I find this very strange but I see it often in physics literature. Are there circumstances where this doesn't work? Please direct me to any source where I can learn more about this.
