Re: Integer designation
- To: mathgroup@smc.vnet.net
- Subject: [mg11783] Re: Integer designation
- From: Bill Bertram <wkb@ansto.gov.au>
- Date: Sat, 28 Mar 1998 00:25:19 -0500
- Organization: ANSTO
- References: <6fd5fr$6b7@smc.vnet.net>
blimbaum_jerry@ccmail.ncsc.navy.mil wrote: > > I want to re-ask a question I asked before about designating a > variable as an integer. On page 261 of the 3rd edition of > Mathematica > it talks about making an integer assignment, i.e. "f[n_Integer] is > like defining a function f that must take an argument of "type" > Integer. I try this in a function like f[x_,n_Integer]:=Sin[n Pi > (x/a)] and then type f[a,n] and expect the answer zero but it just > gives me Sin[n Pi]. What have I misunderstood here? > Jerry, When you define your function f[x,n] as you've done, the function will only return a numerical value if the input value of the second argument is an integer number. If you try to call the function with a non-integer second argument the function does not return a value. Thus, when you ask for f[a,n] you won't get a numerical result unless you have specifically assigned a integer value to n. Hope this helps. Bill