Re: problems with the definition of a function
- To: mathgroup at smc.vnet.net
- Subject: [mg36658] Re: problems with the definition of a function
- From: lalu_bhatt at yahoo.com (Bhuvanesh)
- Date: Wed, 18 Sep 2002 02:09:35 -0400 (EDT)
- References: <am3n85$6tk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
bagarell at unipa.it (fabio bagarello) wrote: > 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 Hi, Something like this? In[1]:= f[x_,y_] := If[Mod[x,2*Pi] === 0, Exp[x], Sin[y]+x] In[2]:= f[4*Pi, y] 4 Pi Out[2]= E In[3]:= f[1, y] Out[3]= 1 + Sin[y] -- Bhuvanesh, Wolfram Research.