Imagine an ideal spring fixed by one end at left side of a wall and stretched horizontally up to L by the right side. Taking an horizontal axis increasing in right direction, having versor $\vec i $, with origin in spring resting position we have:
$$ \vec F = - k x \vec i$$ $$ \vec ds = dx \vec i$$
Work is given by: $\int_0^L \vec F \cdot \vec ds $ = $\int_0^L - k x dx $ = - k L^2 /2
Question is: in the expression: $ \vec ds = dx \vec i$, the displacement dx should be considered a positive real number (component of $ \vec ds$), but I know from mathematics that dx is just a symbol, not a real number. Here instead dx is used to represent an infinitesimal positive displacement. How could this make sense? And can displacement dx actually be used as a positive real number, so as if for example compressing the spring on the other side we would have $ \vec ds = - dx \vec i$ ?