Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: using the result from previous calculation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26224] Re: using the result from previous calculation
  • From: "Paul Lutus" <nospam at nosite.com>
  • Date: Wed, 6 Dec 2000 02:16:13 -0500 (EST)
  • References: <90ejvt$lpk@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Robert Koppensteiner" <koppensteiner.robert at utanet.at> wrote in message
news:90ejvt$lpk at smc.vnet.net...
> Hi to all,
>
> I am a newbie to Mathematica having the following question: When I want
> to use in a programm the previous result (and depending on parameters)
> there have been more than one - and getting a result list - how could I
> use the first one for the following calculations ?

It depends on what you mean by "the first one." In sequence, or in order?

In sequence, use "%" for the prior result, "%%" for the one before that, and
so forth.

If you mean in order, if the previous result is a list or matrix, using
indexing:

Table example:

In[8]:= Table[x*x, {x, 1, 7}]
Out[8]= {1, 4, 9, 16, 25, 36, 49}
In[9]:= %[[6]]
Out[9]= 36

Matrix example:

In[10]:=Table[x*y, {x, 1, 5}, {y, 1, 5}]
Out[10]={{1, 2, 3, 4, 5}, {2, 4, 6, 8, 10}, {3, 6, 9, 12, 15}, {4, 8, 12,
16, 20}, {5, 10, 15, 20, 25}}
In[11]:=%[[5, 5]]
Out[11]=25

--
Paul Lutus
www.arachnoid.com





  • Prev by Date: Re: using the result from previous calculation
  • Next by Date: Newton's method
  • Previous by thread: Re: using the result from previous calculation
  • Next by thread: Volumes