Same function but in different variables [closed]

I am trying to define free fall velocity as a function of time and a function of distance i.e.

$$v(t) = v_0-gt$$

and $$v(y) = \sqrt {v_0^2-2g(y-y_0)}$$

These are essentially the same function considering $y(t) = y_0+v_0 t- \frac 1 2g t^2$. In Mathematica I would like to find if there is a way to define these two functions without having to give them differenty names as this would be cumbersome. They are really the same function but in different variables.

It seems the "function" object in mathematica has a hard time doing this. I have also looked into creating two seperate Context objects, namely a yFunction and tFunction context class aside from the Global context and defining each set of functions there. This seems way too complicated especially since the variables in question, $y$ and $t$ are really global variables and the constants I would like to use would be common to both functions. Is there a quick and dirty way to do this without the ugliness of renaming each function seperately?

closed as unclear what you're asking by Kuba♦, MarcoB, Feyre, Sascha, Simon WoodsJan 13 '17 at 22:41

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• So how do you expect v to be calculated? – Kuba Jan 12 '17 at 8:30
• How about v[t_,"t"]:= v0 - g t and v[y_,"y"]:= Sqrt[v0^2-2g(y-y0)] or v[t_]:= v0 - g t and v[{y_}]:= Sqrt[v0^2-2g(y-y0)] – grbl Jan 12 '17 at 8:39
• what does the ,"t"] after the v[t_ do? I can't find it anywhere in the documentation.... – user32882 Jan 12 '17 at 8:41
• If you want to evaluate the function at t = 2 you would write v[2, "t"] its just an arbitrary pattern. You could use any string you like – grbl Jan 12 '17 at 8:43
• While these two functions express the same physical reality, they are not the "same function" because they operate on different variables and hence different mathematical spaces. You must express them separately because (as pointed out), you must be able to distinguish $v(t=0)$ from $v(y=0)$, and the variables are expressed in different units. – David G. Stork Jan 12 '17 at 8:47