Question: iteration question again

As can be seen in the example i have shown below, i have iterated the "collect" function a number of times as required for the number of distinct terms. Can someone please show me how i would specify that i would like to iterate a particular function 'N' times in the same manner i have done only 3 times in the example, ie suppose instead of the 3 variables i wish to collect for here (a[0],a[1],a[2]) i now must do so for another definition of F that has 'N' variables (a[0],a[1],a[2],....a[N]) 


 

F := ((1/2)*a[2]-a[1]+(1/2)*a[0])*n^2+(-(1/2)*a[2]+2*a[1]-(3/2)*a[0])*n+a[0]

((1/2)*a[2]-a[1]+(1/2)*a[0])*n^2+(-(1/2)*a[2]+2*a[1]-(3/2)*a[0])*n+a[0]

(1)

[factor(op(1, collect(collect(collect(F, a[0]), a[1]), a[2]))/a[2]), factor(op(2, collect(collect(collect(F, a[0]), a[1]), a[2]))/a[1]), factor(op(3, collect(collect(collect(F, a[0]), a[1]), a[2]))/a[0])]

[(1/2)*n*(n-1), -n*(n-2), (1/2)*(n-1)*(n-2)]

(2)

``


 

Download Asking_Again_About_iterations.mw

Please Wait...