       Re: Two related question. Question 1

• To: mathgroup at smc.vnet.net
• Subject: [mg57538] Re: Two related question. Question 1
• From: David Bailey <dave at Remove_Thisdbailey.co.uk>
• Date: Tue, 31 May 2005 05:00:41 -0400 (EDT)
• References: <d7dp2r\$qam\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Kazimir wrote:
> I have two related question. Let me introduce a pure function
>
> f = #1^2 + #2 &
>
> Now. I want to make an operation over the function, for example to
> find its square and to call the result (the expected function f = (#1^2
> + #2)^2 & ) c:
>
> c=f^2
>
> However, I do not obtain this, as
>
> c[a,b]
>
> does not evaluate to (a+b)^2. Can anybody advise me how to obtain
> such a function without long substitutions. I would like to obtain
> something which is made for derivatives :
>
> In:=
> Derivative[f]
>
> Out=
> 2 #1&
>
> In:=
> Derivative[f]
>
> Out=
> 2&
>
> Regards
>
>

Look at your pure function in FullForm, and the answer is more or less
obvious:

Function[Plus[Power[Slot,2],Slot]]

For example:

g=With[{ff=f[]^2},Function[ff]]

Note however that Function can have several arguments, which would
require some more general code.

David Bailey
http://www.dbaileyconsultancy.co.uk

```

• Prev by Date: Re: a dangerous feature of Module[]?
• Next by Date: Re: Related quastions. Question 2
• Previous by thread: Re: Two related question. Question 1
• Next by thread: Mathematica TeX save in standard LaTeX style