Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5453
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!newspump.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail |
|---|---|
| From | Brentt <brenttnewman@gmail.com> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | A variable defaulting to a previous variable? |
| Date | Thu, 6 Oct 2011 08:41:22 +0000 (UTC) |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <j6jpji$mfe$1@smc.vnet.net> (permalink) |
| Lines | 15 |
| NNTP-Posting-Date | 06 Oct 2011 07:44:44 GMT |
| NNTP-Posting-Host | 3682e14e.news.twtelecom.net |
| X-Trace | DXC=X;7;1egDfF>`J[=_:;Y9F<C_A=>8kQj6=m^eQlV`f187:`aS3=N[7J1EFiONJ7[Go6RTcn6GcoK=7 |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:5453 |
Show key headers only | View raw
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