Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5453
| From | Brentt <brenttnewman@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | A variable defaulting to a previous variable? |
| Date | 2011-10-06 08:41 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j6jpji$mfe$1@smc.vnet.net> (permalink) |
How would one go about making a variable default to a previous variable? I would like results like this: In[1]= f[x_, y_: x] := x+y; > In[2]= f[2,3] > Out[1]= 5 > In[3]= f[3] > Out[1]= 6 > But, of course, Mathematica won't let me use a previous argument for the default of the next argument. Is there a way to do this?
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll 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