Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5502

Re: A variable defaulting to a previous variable?

From Simon <simonjtyler@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: A variable defaulting to a previous variable?
Date 2011-10-07 09:06 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j6mff2$7l4$1@smc.vnet.net> (permalink)
References <j6jpji$mfe$1@smc.vnet.net>

Show all headers | View raw


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]

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

A variable defaulting to a previous variable? Brentt <brenttnewman@gmail.com> - 2011-10-06 08:41 +0000
  Re: A variable defaulting to a previous variable? Simon <simonjtyler@gmail.com> - 2011-10-07 09:06 +0000
  Re: A variable defaulting to a previous variable? Peter Pein <petsie@dordos.net> - 2011-10-07 09:09 +0000

csiph-web