Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: := vs = in some function definitions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113257] Re: := vs = in some function definitions
  • From: Pierre Albarede <pa.news at free.fr>
  • Date: Thu, 21 Oct 2010 07:00:47 -0400 (EDT)
  • References: <i9m7u7$j41$1@smc.vnet.net>

On Oct 20, 10:06 am, Sam Takoy <sam.ta... at yahoo.com> wrote:

> Have read everything I could find regarding delayed assignment, I'm
> still not quite sure when to use which.
>
> For example, in the definition
>
> f[x_] = IdentityMatrix[50].Append[Range[1, 49], x];
>
> could there ever be any reason to use :=   ?


If x has a value when you evaluate your definition, il will be used in
the definition, which is not usually what you want.
For example, try :

x = 4

Clear@f; f@x_ = 2 x

?f







  • Prev by Date: Fitting the solution of a differential equation to a data set
  • Next by Date: palettes that would not move
  • Previous by thread: := vs = in some function definitions
  • Next by thread: Re: := vs = in some function definitions