- #1
rbnphlp
- 54
- 0
I need to define two functions for a molecule with speed s.
a)it has a horizontal velocity between -s and s
b) v , the vertical velocity between +Sqrt[s^2-u^2] and -Sqrt[s^2-u^2]
This is what I have done
for a)
for b)
now , If I enter f[2] I get u, so I have s and u from first code. How do I use these values in the second code (without manually inputting them)?
Thanks a bunch
a)it has a horizontal velocity between -s and s
b) v , the vertical velocity between +Sqrt[s^2-u^2] and -Sqrt[s^2-u^2]
This is what I have done
for a)
Code:
f[s_]:=RandomReal[{-s,s}]
Code:
g[s_,u_]:=RandomReal[{-Sqrt[s^2-u^2],+Sqrt[s^2-u^2]}]
now , If I enter f[2] I get u, so I have s and u from first code. How do I use these values in the second code (without manually inputting them)?
Thanks a bunch