how to speed up lenghty formulas??

*To*: mathgroup at smc.vnet.net*Subject*: [mg84104] how to speed up lenghty formulas??*From*: Arkadiusz.Majka at gmail.com*Date*: Mon, 10 Dec 2007 20:35:13 -0500 (EST)

DearAll, I have a general problem with lenghty formula E.g for a data set X X=Table[Random[NormalDistribution[0,5],{100}]]; I define function h: h[0] := Variance[X]; h[1] := a0+ h[0]; h[t_] := h[t] = a0 + a1*X[[t - 1]]^2 + b1*h[t - 1] and H which is the collection of h in all times up to the length of data set X H = Table[h[i], {i, 2, Length[X]}]; Next I define a function: logLike = Total[-Log[H] - (Drop[X, 1]^2/H)]; which I want to minimize in order to find a0,a1,b1 NMinimize[{-logLike, a0> 0 && 1 >a1 > 0 && 1 > b1> 0 && a1+ b1 <1}, {a0, a1, b1}] It works but takes a lot of time and does not scale at all (i.e. when I add an element to X the computational time increases very much) The form of logLike and NMinimize function is only an example of how to deal with very long function but with only a few arguments (here 3) to obtain fast results. Instead of NMinimize you can try to contourplot logLike function or do whatever you want - its time consuming. I know that there existing a solution ,i.e to speed up such computation. The example above is a parameter estimation of GARCH process which in TimeSeries packet runs very fast. But how did developers do so??? Thanks for any help, Arek