Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Defining functions' topicStudent Support Forum > General > Archives > "Defining functions"

Next Comment >Help | Reply To Topic
Author Comment/Response
jordan
02/25/12 11:08am

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)
[CODE]f[s_]:=RandomReal[{-s,s}] [/CODE]
for b)
[CODE]g[s_,u_]:=RandomReal[{-Sqrt[s^2-u^2],+Sqrt[s^2-u^2]}][/CODE]

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)?

URL: ,

Subject (listing for 'Defining functions')
Author Date Posted
Defining functions jordan 02/25/12 11:08am
Re: Defining functions Bill Simpson 02/28/12 8:09pm
Next Comment >Help | Reply To Topic