1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
*
* Calcul de l'esperance d'un polynome, n fini
* ou infini
*
* T. Bousch, 9 avril 1992
Symbols a,c,p,q,r;
Cfunctions x,xx,y;
* Donnez ci-dessous la valeur de n et l'expression
* a fissionner. Si n est infini, mettre zero.
#define n "0"
Local L = (x(-1)+x(0)+x(1))^12;
* Wrapper tous les indices modulo n
#if 'n' > 0
Nwrite Statistics;
#define MAXTOURS "20"
#do j = 0,'n'-1
#do i = -'MAXTOURS','MAXTOURS'
Id x({'i'*'n'+'j'}) = x('j');
#enddo
.sort
#enddo
#endif
Print;
.sort
* Fission
Write Statistics;
#define TRIS "5"
#do i = -'TRIS',0
#if 'i'=0
Repeat;
#endif
Id x(p?)*x(p?) = y(p);
Id y(p?) = a*x(p-1) -c + x(p+1);
#if 'n' > 0
Id x(-1) = x('n'-1);
Id x('n')= x(0);
#endif
#if 'i'=0
Endrepeat;
Print;
#endif
.sort
#enddo
* Regrouper les termes consecutifs
Id x(p?) = y(p,p+1);
Repeat;
Id y(p?,q?)*y(q?,r?) = y(p,r);
Endrepeat;
* Si n est fini, le bloc peut faire le tour
#if 'n' > 0
Id y(0,p?)*y(q?,'n') = y(q,p+'n');
#endif
.sort
* Calculer les esperances
Id y(p?,q?) = x(q-p);
#if 'n' > 0
Id x('n') = x('n')*2 + (1-2^(-'n'))*(1+a^'n');
#endif
Repeat;
Id x(0) = 1;
Id x(1) = 0;
Id x(p?)= 3*a/4 * x(p-2);
Endrepeat;
Print;
.sort
* Et dans le cas quadratique (a=0) on a
Id a = 0;
Print;
.end
|