MathGroup Archive 2005

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

Search the Archive

Validating functions input

  • To: mathgroup at
  • Subject: [mg58784] Validating functions input
  • From: "Nilton" <nilton.volpato at>
  • Date: Mon, 18 Jul 2005 03:21:21 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

I have a function that must have its input validated.


I want to validate if x <= 2^y. If it's valid, then just return the
symbol f[x,y] unevaluated. If it's not valid, I want to return some
symbol, Null for instance, and issue an error message.

The following is a try, but it doesn't work, because it's definition is

f::invalid = "Invalid arguments"
f[x_,y_] := If[x <= 2^y, f[x,y], Message[f::invalid]]

Is there any way to implement this?

-- Nilton

  • Prev by Date: Directed Graph from Adjacency Matrix
  • Next by Date: Re: Improper use of slot
  • Previous by thread: Re: Directed Graph from Adjacency Matrix
  • Next by thread: Re: Validating functions input