Re: Assumptions i Mathematica...

*To*: mathgroup at smc.vnet.net*Subject*: [mg25724] Re: Assumptions i Mathematica...*From*: leko at ix.netcom.com (J. Leko)*Date*: Thu, 19 Oct 2000 04:35:50 -0400 (EDT)*References*: <8sjjc2$fu3@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

In article <8sjjc2$fu3 at smc.vnet.net>, "Jes Hansen" <Whammer.antispam at post9.tele.dk> wrote: > Hi, I'm quite new at this, and I havn't been able to figure out how to tell > Mathematica to assume that a variable, x, is positive. I have a function, > f(x), where I only want to consider positive values of x. I'm using version > 3.0. > > Regards > Jes If you have a function f with a dependent variable x which you want to always be positive, then what you need to do is to conduct a pattern test. Check section 2.3.5, "Putting Constraints on Patterns", in the Mathematica book for more information. Here's an example: In[14]:= f[x_?Positive] := x + 1 In[21]:= f[1] f[0] f[-1] Out[21]= 2 Out[22]= f[0] Out[23]= f[-1] Notice that when x is positive, the function is evaluated, otherwise the function expression is returned. J. Leko Please e-mail replies to leko*j at cspar.uah.edu and remove the *