Re: Test for "valid variable"
- To: mathgroup at smc.vnet.net
- Subject: [mg61688] Re: [mg61659] Test for "valid variable"
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 26 Oct 2005 01:01:41 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
test={a,B,Pi, E};
Head/@test
{Symbol,Symbol,Symbol,Symbol}
Not only must the Head be Symbol but it must not be a symbol for a number.
variableQ[x_] := Head[x]==Symbol&&!NumericQ[x];
variableQ/@test
{True,True,False,False}
Bob Hanlon
>
> From: Marcus Stollsteimer <marcus314 at yahoo.com>
To: mathgroup at smc.vnet.net
> Date: 2005/10/24 Mon PM 09:07:20 EDT
> Subject: [mg61688] [mg61659] Test for "valid variable"
>
> Hi group,
>
> I would like to test whether some parameters of functions are
> "valid variables", similar like e.g. in FourierTransform:
>
> FourierTransform[t UnitStep[t], t, 1]
>
> General::ivar: 1 is not a valid variable.
>
> Is a test for the head "Symbol" the right thing to do?
>
> Best regards,
> Marcus
>
> --
> I would have to ask the questioner. I haven't had a chance
> to ask the questioners the question they've been questioning.
> -- George W. Bush
>
>