Pages

Tuesday, May 5, 2009

Mathematica TIP

Suppose you have to enter 1+x_x^2+...+x^n in full in Mathematica. An easy way to do this is as follows ( for n=11 ).

p[x_]:=Total[Array[x^(#-1)&,12]]

x^11+x^10+x^9+x^8+x^7+x^6+x^5+x^4+x^3+x^2+x+1

No comments:

Post a Comment