Re: Assumptions i Mathematica...
- To: mathgroup at smc.vnet.net
- Subject: [mg25700] Re: Assumptions i Mathematica...
- From: Brian Higgins <bghiggins at ucdavis.edu>
- Date: Thu, 19 Oct 2000 04:35:26 -0400 (EDT)
- References: <firstname.lastname@example.org>
- Sender: owner-wri-mathgroup at wolfram.com
Jes, One way to do this is to use the Condition function in the definition of f(x): i.e. f[x_/;x>0]:=x The above function will only evaluate the RHS if x>0. In:=f[.2] Out=0.2 In:=f[-2] Out=f[-2] You can also add an additional definition for all other values f[x/;<0]:=0 The down side with using this approach is that you cannot do many symbolic operations on your function, e.g. differentiate etc. An alternative method that gives you more flexibilitry is to use the UnitStep function In:=f[x_] := x^3UnitStep[x] In:=D[f[x], x] Out=\!\(x\^3\ DiracDelta[x] + 3\ x\^2\ UnitStep[x]\) Cheers, Brian 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 > > Sent via Deja.com http://www.deja.com/ Before you buy.