MathGroup Archive 1997

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

Search the Archive

Re: How do I tell Mathematica than n is an integer?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9608] Re: How do I tell Mathematica than n is an integer?
  • From: Leszek Sczaniecki <lsczan at concentric.net>
  • Date: Fri, 14 Nov 1997 21:39:50 -0500
  • Organization: Concentric Internet Services
  • Sender: owner-wri-mathgroup at wolfram.com

foo[n_] :=  OK /; IntegerQ[n]  && Positive[n] IntegerQ[n] ^= True;
Positive[n] ^= True;

-leszek

michael a. morrison wrote:

> In writing some packages for courses I'm teaching, I've run into the
> following recurrent difficulty:
>
> How do you tell Mathematica within a notebook session that a variable n
> is a positive integer in such a way that a command defined in a package
> such as
>     waveFunction[n_Integer?Positive] :=  will execute rather than
> returning waveFunction[n] unevaluated. Setting
>         Integer[n] ^= True;
>         Postive[n] ^= True;

               A                !

> in the notebook has no effect whatsoever on the failure of Mathematica
> to evaluate waveFunction[n].
>
> I would be very grateful for any advice anyone can give me!
> Thanks---michael morrison (university of oklahoma)
>
> Michael A. Morrison
> Dept. Physics & Astronomy
> University of Oklahoma
> Norman, OK 73019
> Phone: 405 325-3961
> FAX: 405 325-7557




  • Prev by Date: Re: Plot Complex Interpol .Func.
  • Next by Date: Re: Book recommendation for engineers
  • Previous by thread: Re: How do I tell Mathematica than n is an integer?
  • Next by thread: Re: How do I tell Mathematica than n is an integer?