I've gone through many math courses thinking that a function $f(x)=x^2$ could mean $f(anything) = anything^2$, however I realized that that isn't always true.
For example, suppose we have a function $f(x) = kx$ where $f$ represents the opposing force. We can't just substitute $t$ for time into that equation, as that isn't physically true. It could be the case that $x=2t$. In that case, $f(t) = 2kt$.
But suppose that $t$ is actually a function of another variable $p$. Let $t(p)= p^2$. If I were to naively try to do function composition to get $f(t(p))$, I would get $f(t(p)) = kp^2$, ignoring the relationship between $x$ and $t$. The correct answer would be $f(t(p)) = 2kp^2$.
What is really going on when I do the above function composition? Is there something more complex going on?
Update:
Even after reading @peek-a-boo's post, I am still confused about a couple of points. I guess my original question might not have been as clear as I wanted it to be.
Say we have a spring that follows Hooke's law $F_s(x) = -kx$, where F is the spring's force in newtons, and x is spring's compression in meters. It seems to me (I might be wrong) that it is incorrect to say that $F_s(t) = -kt$, where $t$ is time. My reasoning for that is that it isn't necessarily the case that the force at a certain compression is equal to the force at the same time.
Question 1: Is my reasoning correct? Is it wrong to "plug in" $t$ into $F_s(x) = -kx$?
My understanding that you could "plug in" $t$ in the sense that it is a dummy variable, but you can't in the sense of time. You would have to account for the fact that $x$ is a function of $t$.`
Question 2: If my reasoning is correct (you can ignore this question if it is not), why is it not correct to plug in $t$ here?
Now let us define a new function F:R→R as F(x)=kx (I’m explicitly using a different letter than f because the f above is different from this F). If you now fix a number t and decide to consider the number x=2t, then F(x)=F(2t)=k(2t)=2kt.
As for this, I see that "plugging in" $2t$ into $F(x)$ leads to the physically correct functions: $F(x)=F(2t)=k(2t)=2kt$, but what if I wanted $F(t)$ to be a function where I could get the force from just inputting a time $t$? What would $F(t)$ be?