Re: problems with the definition of a function

*To*: mathgroup at smc.vnet.net*Subject*: [mg36656] Re: problems with the definition of a function*From*: "PSi" <no at eee.gr>*Date*: Wed, 18 Sep 2002 02:09:32 -0400 (EDT)*References*: <am3n85$6tk$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

"fabio bagarello" <bagarell at unipa.it> wrote in message news:am3n85$6tk$1 at smc.vnet.net... > Hi there!! > I have quite an easy and annoying problem with mathematica: > I need to define a function f(x,y) which takes some values for > x=0,2pi,4pi (indepently of y) and has a different expression for all > the other values of y. This is easily done for one-dimensional > functions but I am in serious troubles for my two-dimensional problem: > any suggestion? > Thanks a lot, > Fabio > f[0, y_] := 5 f[2 Pi, y_] := 7 f[4 Pi, y_] := -3 f[x_ /; x < 0, y_] := x y f[x_ /; 0 < x < 2 Pi, y_] := x + y f[x_ /; 2Pi < x < 4 Pi, y_] := x - y f[x_ /; 4Pi < x, y_] := 2x y