2

When trying to do symbolic calculations in mathematica involving a space of dimension n, which is arbitrary but fixed, I'd often like to work with vectors that have arbitrary but fixed length n. So I'd like to have a vector defined like vec = Array[v,n], which of course does only work if n has been initialized with an integer value before. I'd then like to apply some differential operators like let's say D[vec,v[2]]. Does anybody know an elegant way to do that (maybe using the new Inactive construct in Mathematica 10)?

p.s.: Interestingly enough mathematica supports sums of arbitrary length, which for example enables the following kind of symbolic computation:

x /: D[x[i_], x[j_], NonConstants -> {x}] := KroneckerDelta[i, j];
D[Sum[x[i], {i, 1, n}], x[2], NonConstants -> x];

which yields the correct result:

Piecewise[{{1, n > 1}}, 0]

Wizard
  • 2,720
  • 17
  • 28

0 Answers0