I have variables $X1,...,X10$ and $X1hat,..., X10hat$ in a system of equations. How can I refer to these variables in a summation? I am looking for something like:

Sum[X`i' X`i'hat,{i,10}]
  • $\begingroup$ Instead of x1, use x[1]. Then you can use x[i]. $\endgroup$ – Szabolcs May 7 '17 at 7:37
  • $\begingroup$ Thanks! It solved my problem for variables. But is there also a way to do something similar for an equation to avoid writing it multiple times? For example instead of writing eq1=X[1]^2,...,eq10=X[10]^2, write something like: {eq[i] = X[i]^2, {i, 10}} in a system of equations? $\endgroup$ – Hossein May 7 '17 at 7:51
  • $\begingroup$ Use Table to make a list of equations. $\endgroup$ – Szabolcs May 7 '17 at 8:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.