|
[Date Index]
[Thread Index]
[Author Index]
Default and head in function argument
- To: mathgroup at smc.vnet.net
- Subject: [mg111604] Default and head in function argument
- From: NP <nomplume69 at gmail.com>
- Date: Sat, 7 Aug 2010 01:31:25 -0400 (EDT)
Hi,
I know how to define a function so that it evaluates only when the
head of the argument is of a certain type:
Clear[f];
f[x_Integer?Positive] := x^3
f[3]
f[3.1]
f[-3]
27
f[3.1]
f[-3]
and I also know how to set default to an argument of a function like
so:
Clear[f]
f[x_:3]
f[]
27
How do I do both i.e., specify head and default value?
Thanks,
NP
Prev by Date:
Re: A new graphic user interface
Next by Date:
parallel computing and message disabling
Previous by thread:
Re: Rearrange equation II
Next by thread:
Re: Default and head in function argument
|