Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

RE: problems with the definition of a function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36665] RE: [mg36651] problems with the definition of a function
  • From: "DrBob" <drbob at bigfoot.com>
  • Date: Wed, 18 Sep 2002 02:09:48 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

>>and has a different expression for all the other values of y.

Do you mean "all the other values of x"?  You can't expect to make
yourself understood to Mathematica, if you don't say what you mean.
Mathematica can't guess, like we can.

If that's what you meant, it's really easy:

f[0 | N[0], y_] := y
f[2*Pi | N[2*Pi], y_] := y^2
f[4*Pi | 4.*Pi, y_] := y^3
f[x_, y_] := y^4

If the first three of those expressions are supposed to be the same, you
can substitute

f[0 | N[0] | 2*Pi | N[2*Pi] | 4*Pi | 4.*Pi, y_] := y^3

Bobby Treat

-----Original Message-----
From: fabio bagarello [mailto:bagarell at unipa.it] 
To: mathgroup at smc.vnet.net
Subject: [mg36665] [mg36651] problems with the definition of a function

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





  • Prev by Date: Re: problems with the definition of a function
  • Next by Date: Re: Postponing loading of Package
  • Previous by thread: Re: problems with the definition of a function
  • Next by thread: RE: problems with the definition of a function