MathGroup Archive 2005

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

Search the Archive

Re: Two related question. Question 1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57532] Re: Two related question. Question 1
  • From: "Michael Taktikos" <michael.taktikos at hanse.net>
  • Date: Tue, 31 May 2005 05:00:02 -0400 (EDT)
  • References: <d7dp2r$qam$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Kazimir wrote
> 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.

An operation over a function can expressed itself as pure function:

op=#^2&

and then we can define

c=Apply[op,f]

(#1^2 + #2)^2

Regards,

Michael Taktikos



  • Prev by Date: Re: sum the elements of a list
  • Next by Date: Block vs Module
  • Previous by thread: Re: Two related question. Question 1
  • Next by thread: Re: Two related question. Question 1