MathGroup Archive 2001

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

Search the Archive

Re: A=B example


Erich,
The culprit seem to be the symbol  a; the following works

In[54]:=
findrecur[f_,ii_,jj_]:=
  Block[{a},
    Module[{yy,zz,ll,tt,uu,r,s,i,j},
      yy=Sum[Sum[a[i,j]*FullSimplify[f[n-j,k-i]/f[n,k]],{i,0,ii}],{j,0,jj}];
      zz=Collect[Numerator[Together[yy]],k];
      ll=CoefficientList[zz,k];
      tt=Flatten[Table[a[i,j],{i,0,ii},{j,0,jj}]];
      uu=Flatten[Simplify[Solve[ll\[Equal]0,tt]]];
      For[r=0,r\[LessEqual]ii,r++,
        For[s=0,s\[LessEqual]jj,s++,a[r,s]=Replace[a[r,s],uu]]];
      Sum[Sum[a[i,j] F[n-j,k-i],{i,0,ii}],{j,0,jj}]\[Equal]0]
    ]

In[55]:=

f[n_,k_]:=n!/(n-k)!

In[56]:=
findrecur[f,1,1]

Solve::svars:Equations may not give solutions for all "solve" variables.

Out[56]=
a[1, 1]*F[-1 + n, -1 + k] - (a[1, 1]*F[n, k])/n == 0

In[57]:=
findrecur[f,1,1]

Solve::svars: Equations may not give solutions for all "solve" variables.

Out[57]=
a[1, 1]*F[-1 + n, -1 + k] - (a[1, 1]*F[n, k])/n == 0

--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"Erich Neuwirth" <erich.neuwirth at univie.ac.at> wrote in message
news:a0h7pl$ssr$1 at smc.vnet.net...
> this has probably been asked before.
> being new to the list i would be happy with a pointer to previous
> answers.
>
>
> in A=B by Wilf and Zeilberger,
> on page 61 there is the following program for deriving recursions
> explicitly
> (i had to change FactorialSimplify to FullSimplify
> because the original version was for mathematica 2.2):
>
>
> findrecur[f_, ii_, jj_] :=
>   Module[{yy, zz, ll, tt, uu, r, s, i, j},
>     yy = Sum[
>         Sum[a[i, j] *FullSimplify[f[n - j, k - i]/f[n, k]], {i, 0, ii}],
> {j,
>           0, jj}];
>     zz = Collect[Numerator[Together[yy]], k];
>     ll = CoefficientList[zz, k];
>     tt = Flatten[Table[a[i, j], {i, 0, ii}, {j, 0, jj}]];
>     uu = Flatten[Simplify[Solve[ll == 0, tt]]];
>     For[r = 0, r <= ii, r++,
>       For[s = 0, s <= jj, s++,
>         a[r, s] = Replace[a[r, s], uu]]];
>     Sum[Sum[a[i, j]  F[n - j, k - i], {i, 0, ii}], {j, 0, jj}] == 0]
>
> defining
> f[n_, k_] := n!/(n - k)!
>
> and executing
> findrecur[f,1,1]
> works,
> but trying to run exactly the same statement a second time
> produces a lot of errors and effectively hangs mathematica.
>
> is there a solution?
>
>
>
> --
> Erich Neuwirth, Computer Supported Didactics Working Group
> Visit our SunSITE at http://sunsite.univie.ac.at
> Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
>




  • Prev by Date: Re: A=B example
  • Next by Date: Re: Front end problems!
  • Previous by thread: Re: A=B example
  • Next by thread: Non-linear Boundary Diff equations