Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Re: Re: Warning from Piecewise
  • Next by Date: Re: notebook directory
  • Previous by thread: Re: Integrate vs Nintegrate for impulsive functions
  • Next by thread: IMAP interface to Mathematica