MathGroup Archive 2011

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

Search the Archive

Re: sequence of functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120135] Re: sequence of functions
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Sat, 9 Jul 2011 07:33:10 -0400 (EDT)
  • References: <iv6hbv$sau$1@smc.vnet.net>

I would attack the problem using an auxiliary function g to avoid a 
recurrence loop defined as

g[n_, x_] := f[n - 1, 2x] + f[n - 1, 2x - 1]

Now we can calculate the first, say 5, iterations thus

Table[f[k, x_] = g[k, x], {k, 1, 5}] /. f[0, x_] -> x(1 - x) // Expand 
//InputForm
{-2 + 8*x - 8*x^2, -20 + 64*x - 64*x^2,
-168 + 512*x - 512*x^2, -1360 + 4096*x - 4096*x^2,
-10912 + 32768*x - 32768*x^2}

I hope this helps
Regards,
Wolfgang

"rych" <rychphd at gmail.com> schrieb im Newsbeitrag 
news:iv6hbv$sau$1 at smc.vnet.net...
>I would like to build a function sequence inductively, for example
> f[n][x]=f[n-1][2x]+f[n-1][2x-1], f[0][x] = x(1-x)
>
> This is what I tried in Mathematica,
>
> ClearAll["Global`*"]
> f[n_] = Function[x, Simplify[f[n - 1][2 x] + f[n - 1][2 x - 1]]];
> f[0] = Function[x, x (1 - x)];
>
> f[2][x]
> Out:
> -20 + 64 x - 64 x^2
>
> ?f
> Out:
> Global`f
> f[0]=Function[x,x (1-x)]
> f[n_]=Function[x,Simplify[f[n-1][2 x]+f[n-1][2 x-1]]]
>
> My questions: it doesn't seem to cache the previous f[n-1] etc? If I
> do it this way instead,
> f[n_] := f[n] = Function[...
>
> Then it does cache the f[n-1] etc. but still in the unevaluated form,
> Global`f
> f[0]=Function[x,x (1-x)]
> f[1]=Function[x$,Simplify[f[1-1][2 x$]+f[1-1][2 x$-1]]]
> f[2]=Function[x$,Simplify[f[2-1][2 x$]+f[2-1][2 x$-1]]]
> f[n_]:=f[n]=Function[x,Simplify[f[n-1][2 x]+f[n-1][2 x-1]]]
>
> How do I force the reduction so that I see f[1] = -2 (1 - 2 x)^2, 
> etc.
> in the definitions?
>
> Thanks,
> Igor
>
> 



  • Prev by Date: Re: sequence of functions
  • Next by Date: Re: Numerical optimization
  • Previous by thread: Re: sequence of functions
  • Next by thread: Re: sequence of functions