Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: sequence of functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120191] Re: sequence of functions
  • From: Dana DeLouis <dana01 at me.com>
  • Date: Tue, 12 Jul 2011 06:59:36 -0400 (EDT)

Hi.  Just to be different...

What we have...
Function[x,a+b x + c x^2][2x]+Function[x,a+b x + c x^2][2x-1];

Collect[%,x]
2 a-b+c+(4 b-4 c) x+8 c x^2

We start with:

x (1-x)//Expand
x-x^2

Our data:

equ={
a[0]==0,
b[0]==1,
c[0]==-1,
a[n]==2 a[n-1]-b[n-1]+c[n-1],
b[n]==(4 b[n-1]-4 c[n-1]),
c[n]==8 c[n-1]};
RSolve[equ,{a[n],b[n],c[n]},n]//FullSimplify

{{
a[n]->-(1/3) 2^n (4^n-1),
b[n]->8^n,
c[n]->-8^n
}}

So, our 5th sequence:

-(1/3) 2^n (-1+4^n) /.n->5
-10912

8^n /.n->5
32768

-8^n /.n->5
-32768

Which checks with the answer given by others:

-10912 + 32768*x - 32768*x^2

= = = = = = = = = =
HTH  : >)
Dana DeLouis
$Version
8.0 for Mac OS X x86 (64-bit) (November 6, 2010)

To understand recursion, one must first understand recursion.
= = = = = = = = = =

On Jul 8, 5:07 am, rych <rych... at gmail.com> wrote:
> 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: How to write a "proper" math document
  • Next by Date: Re: How to write a "proper" math document
  • Previous by thread: Re: sequence of functions
  • Next by thread: Search and replace variable name with subscript