Re: Test function argument with VectorQ and NumericQ
- To: mathgroup at smc.vnet.net
- Subject: [mg107315] Re: [mg107305] Test function argument with VectorQ and NumericQ
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Tue, 9 Feb 2010 02:43:51 -0500 (EST)
- References: <201002081254.HAA07544@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
For instance, Clear[f] f[list : {__?NumericQ}, y_?NumericQ] := {y, list} f[{1, 2, 3}, 4] {4, {1, 2, 3}} Bobby On Mon, 08 Feb 2010 06:54:52 -0600, Oliver Fochler <janitor048 at googlemail.com> wrote: > Hi there, > > in order to get my NIntegrate running properly it seems that I need to > ensure that my functions actually take numeric arguments (without > NIntegrate trying to do some symbolic stuff before). > > For a simple case something like > > f[x_?NumericQ] := (stuff) > > seems to work fine. However, I do use vectors (lists) as function > arguments, i.e. f[x_, y_]:= (stuff) needs to be called as f[ {1,2,3}, > 4]. > How do I test this for numerical values? I know that I can use > VectorQ[ x, NumericQ ] to check whether x is a vector that contains > only numeric values. > > But how do I combine this into a pattern test, that can be used in an > argument list? > I would appreciate any help! > > Cheers, > Oliver > -- DrMajorBob at yahoo.com
- References:
- Test function argument with VectorQ and NumericQ
- From: Oliver Fochler <janitor048@googlemail.com>
- Test function argument with VectorQ and NumericQ