Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: A variable defaulting to a previous variable?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121971] Re: A variable defaulting to a previous variable?
  • From: Simon <simonjtyler at gmail.com>
  • Date: Fri, 7 Oct 2011 04:50:29 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j6jpji$mfe$1@smc.vnet.net>
  • Reply-to: comp.soft-sys.math.mathematica at googlegroups.com

Maybe the easiest way would be to define 

f[x_, y_] := x + y
f[x_] := 2 x

Or maybe something like

Module[{yy}, f[x_, y_: yy] := x + y /. yy -> x]



  • Prev by Date: Calendar Info
  • Next by Date: Re: list equation
  • Previous by thread: Re: A variable defaulting to a previous variable?
  • Next by thread: Re: A variable defaulting to a previous variable?