I have the following code, but Mathematica insists that xj
is not a symbol! How may I fix that?
n={5,10,20};
Subscript[x, 1]=Table[0,{Subscript[n, [[1]]]+1}];
Subscript[x, 2]=Table[0,{Subscript[n, [[2]]]+1}];
Subscript[x, 3]=Table[0,{Subscript[n, [[3]]]+1}];
For[j=1,j<=3,j++,
For[i=0,i<=Subscript[n, [[j]]],i++,
Subscript[x, j][[i+1]]=i/Subscript[n, [[j]]];
];
];
and the error is
Set::setps: Subscript[x, j] in the part assignment is not a symbol. >>
Set::setps: Subscript[x, j] in the part assignment is not a symbol. >>
Set::setps: Subscript[x, j] in the part assignment is not a symbol. >>
General::stop: Further output of Set::setps will be suppressed during this calculation. >>
I want to do this,
We have three vectors such as $x_1$,$x_2$ and $x_3$ with length $n_1$, $n_2$ and $n_3$ respectively. Let $n=\{n_1, n_2, n_3\}$. I want to calculate $x_i = \frac{i}{n_j}$, $i=0,\ldots,n_j$ which $j=1,2,3$. I want to express it mathematically as possible as it can be!