MathGroup Archive 1994

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

Search the Archive

function definition

  • To: mathgroup at christensen.cybernetics.net
  • Subject: function definition
  • From: D_Kramer at ACAD.FANDM.EDU (David Kramer)
  • Date: Mon, 17 Oct 1994 08:43:31 -0400

Can anyone explain the principle for function definition that yields the
following:
First define f2[x]:
in: f2[x_] := x + 2;

in: ?f2
out: Global`f2
f2[x_] := x + 2

Now re-define f2[x], and we see that the old definition has been overwritten:
in: f2[x_] := x + 3;

in: ?f2
out: Global`f2
f2[x_] := x + 3

But now define f2[y], and see that the old definition
is the one that is used by Mma!
in: f2[y_] := y + 4;
out: ?f2
Global`f2
f2[x_] := x + 3
f2[y_] := y + 4

Check out values of f2. They're all from the x + 3 definition:
in: f2[x]
out: 3 + x
in: f2[y]
out: 3 + y
in: f2[1]
out: 4


_____________________________/________________________________________________
David Kramer                               Telephone: (717) 291-4339
Coordinator of Academic Computing          e-mail:    D_Kramer at Acad.FandM.edu
Franklin & Marshall College                FAX:       (717) 399-4446
Lancaster, Pennsylvania 17604-3003 USA
_______________________________________________________________________\______







  • Prev by Date: Math on Sun..Help!
  • Next by Date: simplifing inverse functions
  • Previous by thread: Re: Math on Sun..Help!
  • Next by thread: RE: function definition