<< FGN.m

Examples

Test Error Situation (TrenchInverse not called first)

r = TacvfAR[{1.8, -0.9}, 100]; r = r/First[r];

r1 = Take[r, 50]; r2 = Drop[r, 50];

R2 = TrenchInverseUpdate[r2];

Take care to have r[[1]]=1

r = TacvfAR[{1.8, -0.9}, 100]; r = r/First[r];

RI = TrenchInverse[toe[r]];

r1 = Take[r, 50]; r2 = Drop[r, 50];

R1 = TrenchInverse[toe[r1]];

R2 = TrenchInverseUpdate[r2];

Dimensions[R2]

Max[Abs[R2 - RI]]

Now with r[[1]]≠  1

r = Table[FGNAcf[k, 0.8], {k, 0, 99}];

RI = TrenchInverse[toe[r]];

r1 = Take[r, 50]; r2 = Drop[r, 50];

R1 = TrenchInverse[toe[r1]];

R2 = TrenchInverseUpdate[r2];

Dimensions[R2]

Max[Abs[R2 - RI]]

Timing Test Followed by Examples

Timings for TrenchM

phis = ReadList["d:/r/2005/trench/phi.dat",  Real];

EPS = $MachineEpsilon;

phi1 = phis[[3]]; 
    n = 1000;

c = phi1^Range[0, n - 1]/(1 - phi1^2); 
r = 
      c/c[[1]];

rout = TrenchM[r, EPS, 1];

Total[rout]

NMAX = 1000; NSTART = 200; NINC = 200;
tb = Array[{0, 0} &,  NMAX/NINC];
Do[
phi1 = 
          phis[[
            k]]; 
tb += 
          Table[
c = 
              phi1^Range[0, n - 1]/(1 - phi1^2); 
r = 
              c/c[[1]]; 
{n, 
              Timing[TrenchM[r, EPS, 1];] // 
                First}, 
{n, NSTART, NMAX, 
              NINC}
], 
{k,  
          Length[phis]}
];
tb = tb/Length[phis];
TableForm[tb, 
      TableHeadings -> {None, {"n",  "time"}}]

Now with r[[1]]≠  1

r = Table[FGNAcf[k, 0.8], {k, 0, 99}];

RI = TrenchInverse[toe[r]];

r1 = Take[r, 50]; r2 = Drop[r, 50];

R1 = TrenchInverse[toe[r1]];

R2 = TrenchInverseUpdate[r2];

Dimensions[R2]

Max[Abs[R2 - RI]]