Re: ways to save the output from a notebook

• To: mathgroup at smc.vnet.net
• Subject: [mg93431] Re: [mg93408] ways to save the output from a notebook
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Fri, 7 Nov 2008 06:02:37 -0500 (EST)

```Immediate evaluation:

Clear[F];

F[x1_, x2_] = Module[{Yeni, Eski}, Yeni = x1^2;
Eski = x2^3]

x2^3

?F

Global`F

F[x1_,x2_]=x2^3

Table[F[x1, x2], {x1, 3}, {x2, 3}];

?F

Global`F

F[x1_,x2_]=x2^3

The definition of F has not been changed by use.

Delayed evaluation :

Clear[F];

F[x1_, x2_] := Module[{Yeni, Eski}, Yeni = x1^2;
Eski = x2^3]

?F

Global`F

F[x1_,x2_]:=Module[{Yeni,Eski},Yeni=x1^2;Eski=x2^3]

Table[F[x1, x2], {x1, 3}, {x2, 3}];

?F

Global`F

F[x1_,x2_]:=Module[{Yeni,Eski},Yeni=x1^2;Eski=x2^3]

Again, the definition of F has not been changed by use.

Delayed evaluation with embedded immediate evaluation:

Clear[F];

F[x1_, x2_] := F[x1, x2] = Module[{Yeni, Eski}, Yeni = x1^2;
Eski = x2^3];

Note that the patterns only appear on the far LHS

?F

Global`F

F[x1_,x2_]:=F[x1,x2]=Module[{Yeni,Eski},Yeni=x1^2;Eski=x2^3]

Table[F[x1, x2], {x1, 3}, {x2, 3}];

?F

Global`F

F[1,1]=1

F[1,2]=8

F[1,3]=27

F[2,1]=1

F[2,2]=8

F[2,3]=27

F[3,1]=1

F[3,2]=8

F[3,3]=27

F[x1_,x2_]:=F[x1,x2]=Module[{Yeni,Eski},Yeni=x1^2;Eski=x2^3]

The definition of F remembers the results of each call. This is particularly useful to speed up multiple calls to recursive defintions. See

http://reference.wolfram.com/mathematica/tutorial/FunctionsThatRememberValuesTheyHaveFound.html

Bob Hanlon

---- Tugrul Temel <temelt at xs4all.nl> wrote:

=============
Dear All,

Suppose that I have:

F[x1_,x2_]:=F[x1_,x2_]=
Module[
{Yeni, Eski},
Yeni=x1^2 ;
Eski=x2^3
]

What role does F[x1_,x2_]:=F[x1_,x2_] have? What does it do?

Regards,
Tugrul

```

• Prev by Date: RE: Re: using the output from a notebook in another notebook
• Next by Date: Re: Constructing a Label
• Previous by thread: RE: ways to save the output from a notebook
• Next by thread: RE: Re: Format Type of new Output Cells to OutputForm