       RE: How to define new function using the previous output?

• To: mathgroup at smc.vnet.net
• Subject: [mg36396] RE: [mg36375] How to define new function using the previous output?
• From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
• Date: Wed, 4 Sep 2002 21:22:07 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```>-----Original Message-----
>From: Peter [mailto:psutovsk2 at hotmail.com]
To: mathgroup at smc.vnet.net
>Sent: Wednesday, September 04, 2002 8:56 AM
>Subject: [mg36396] [mg36375] How to define new function using the
>previous output?
>
>
>Hello,
>
>What is a efficient way to use output expression to define new
>function.
>
> Thank you,
>                                   Peter
>
>
>
>
Peter,

I'd say none,... 'cause look at

In:= y = x^2
Out= x^2

In:= f1[x_] = Out
Out= x^2

In:= f2[x_] := Out

In:= x = 5
Out= 5

In:= f3[x_] = Out
Out= 25

In:= Block[{x}, f4[x_] = Out]
Out= 25

In:= Block[{x}, f5[x_] := Out]

In:= \$HistoryLength = 11;

In:= f6[x_] = y
Out= 25

In:= Block[{x}, f7[x_] = y]
Out= 25

In:= f8[x_] := y

In:=
Through[{f1, f2, f3, f4, f5, f6, f7, f8}[#]] & /@ {0, 1}
Out= {{0, 25, 25, 0, 25, 25, 0, 25},
{1, 25, 25, 1, 25, 25, 1, 25}}

In:= Block[{x}, f9[x_] = Out]
Out= %1

In:=
Through[{f1, f2, f3, f4, f5, f6, f7, f8, f9}[#]] & /@ {0, 1}
Out= {{0, %1, 25, 0, %1, 25, 0, 25, %1},
{1, %1, 25, 1, %1, 25, 1, 25, %1}}

f1, f4 and f7 come out right, but f1 is based on the condition that the
pattern variables of the expression have not been redefined, and f4 is only
correct if the history is remembered well. So what rests is f7, but that
wasn't you question.

--
Hartmut Wolf

```

• Prev by Date: Re: List argument
• Next by Date: Re: Re: approximation for partitial binomial sum
• Previous by thread: Re: How to define new function using the previous output?
• Next by thread: List argument