Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

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

Search the Archive

Re: defining a function of functions

  • To: mathgroup at
  • Subject: [mg110478] Re: defining a function of functions
  • From: Raffy <adraffy at>
  • Date: Sun, 20 Jun 2010 03:45:48 -0400 (EDT)
  • References: <hviav7$hbl$>

On Jun 19, 7:51 am, J Davis <texasauti... at> wrote:
> I want to define an inner product function such as
> (here mylist is a specified list and L is a specified constant)
> innerprod[f_, g_] = Sum[f[k]Conjugate[g[k]]Part[mylist,k],{k,1,L}]
> This works fine but now I need to apply it in a situation where f is a
> function of 2 variables while g is a function of only one variable,
> i.e. I want to compute something like the inner product of f[2,n] and
> g[n].
> Of course, I want the ability to freely vary the first input of f.
> I have accomplish this before rather easily but I'm presently drawing
> a blank.
> Thanks for your help.
> Best,
> JD

There are multiple solutions, two of which are:

1. pass f as f[2,#]& => interprod[ f[2,#]&, g ]

2. redefine f[m, n] as f[m][n] => interprod[ f[2], g ]

  • Prev by Date: Re: Bar chart style with ListPlot
  • Next by Date: Re: Named patterns forbidden in Except?
  • Previous by thread: Re: defining a function of functions
  • Next by thread: Re: defining a function of functions