MathGroup Archive 2003

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

Search the Archive

Re: Problems defining function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40393] Re: Problems defining function
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 4 Apr 2003 01:21:00 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <b6gm4c$cff$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

> Hello,
> I am defining a function:
> h[x_]:=0/;x<0
> h[x_]:=x/;x>=0
> 
> When I try to plot the function:
> Plot[h[x],{x,-1,1}]
> 
> I see that it's defined as h[x_]:=x on all values, not only positive ones.
> What am I missing here?


your eyeglasses ?

Clear[h] or start a fresh Mathematica kernel or try

h[x_] := UnitStep[x]*x

Anyway you definition above is correct and you can check it
with

DownValues[h]

Regards
  Jens


  • Prev by Date: RE: Problems defining function
  • Next by Date: Re: exporting eps-files with embedded characters in 4.2.1
  • Previous by thread: RE: Problems defining function
  • Next by thread: Newbie: "key combination is not defined"