I'm rather new to Mathematica so I would greatly appreciate any help. I want to find the series expansion coefficients of iterations of a function and export them as a .csv. Here is what I have written so far:

f[x_] := Sin[x]
iterations = 10;

When I run this, I receive the following errors after the for loops:

Set::partd1: Depth of object Coeff[[i,j]] is not sufficient for the given part specification.
General::stop: Further output of Set::partd1 will be suppressed during this calculation.

Is there an easier way to make what I am trying to make? I'm sure i and j are in bounds in terms of the depth of the array (I have enough array elements to satisfy the for loops).

Thank you for your help.


1 Answer 1


Perhaps this?:

funcs = Rest@NestList[Sin, x, 10];

coeff = Table[
   SeriesCoefficient[Series[f, {x, 0, 11}], k],
   {f, funcs}, {k, 0, 10}];

coeff // Column

See Why should I avoid the For loop in Mathematica? for alternatives for for loops.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.