MathGroup Archive 2011

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

Search the Archive

Re: sequence of functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120199] Re: sequence of functions
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 12 Jul 2011 07:01:02 -0400 (EDT)
  • References: <201107080855.EAA28789@smc.vnet.net> <iv9eqf$dfb$1@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

> Bobby, f[n_][x_] :=  f[n][x] = ... results in caching for not only
> each n and each x.

"...for not only each n, but also for each x...", you mean.

Good point!

Here's another solution, without that defect:

ClearAll[f, x]
f[0] = # (1 - #) &;
f[n_Integer?Positive] :=
  With[{s = Simplify[f[n - 1][2 #] + f[n - 1][2 # - 1]]}, f[n] = s &]

or

ClearAll[f, x]
f[0] = # (1 - #) &;
f[n_Integer?Positive] :=
  With[{s = FullSimplify[f[n - 1][2 #] + f[n - 1][2 # - 1]]},
   f[n] = s &]

Bobby

On Mon, 11 Jul 2011 05:56:58 -0500, rych <rychphd at gmail.com> wrote:

> Yes, indeed, wrapping it with Evaluate did it. Thanks, Heike.
>
> Bobby, f[n_][x_] :=  f[n][x] = ... results in caching for not only
> each n and each x.
>
> Dana, how did you apply FindSequenceFunction to get the direct
> formula?!
>
> Thanks
> Igor
>
>
>
> On Jul 9, 11:42 pm, Heike Gramberg <heike.gramb... at gmail.com> wrote:
>> What about
>>
>> f[0] = Function[x, x (1 - x)]
>> f[n_] := f[n] =
>>    Function[x, Evaluate[Simplify[f[n - 1][2 x] + f[n - 1][2 x - 1]]]];
>>
>> Then
>>
>> f[2][x];
>> ?f
>>
>> returns:
>>
>> Global`f
>> f[0]=Function[x,x (1-x)]
>> f[1]=Function[x$,-2 (1-2 x$)^2]
>> f[2]=Function[x$,-20+64 x$-64 x$^2]
>> f[n_]:=f[n]=Function[x,Evaluate[Simplify[f[n-1][2 x]+f[n-1][2 x-1]]]]
>>
>> Heike
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Numerical accuracy/precision - this is a bug or a feature?
  • Next by Date: Re: Which Test is Used to Verify Assumptions in TTest
  • Previous by thread: Re: sequence of functions
  • Next by thread: Re: sequence of functions