필터 지우기
필터 지우기

Help with indexing in MuPAD

조회 수: 1 (최근 30일)
yogesh
yogesh 2013년 10월 24일
댓글: yogesh 2013년 10월 25일
Hi,
I am looking for some help to do the following in MuPAD :
AA := sum(sum(q[i][j],i=1..2),j=1..2)
This gives me AA = q11 + q12 + q21 + q22. Now I want to specify that q12 = q21. How would I do that? I tried to use the 'Assume' command in MuPAD, but haven't made much progress.
Also, What is the difference between writing 'q_1' and 'q[1]' in MuPAD. I guess the first one refers to a subscript while the second one acts like an index. Is this right?
Thanks,
yogesh

채택된 답변

Walter Roberson
Walter Roberson 2013년 10월 25일
q_1 is a full symbol name that happens to be displayed as if there is a subscript, but there is no relationship between (say) q_1 and q_2 .
q[1] uses the indexing method of the datatype that "q" is.
Your code will not give
AA = q11 + q12 + q21 + q22
it will give
AA = q[1][1] + q[1][2] + q[2][1] + q[2][2]
Unless, that is, that q[1][1] happens to have been given a value that the symbol q11 (and so on.) Which is possible if you defined q as a Matrix but did not initialize it.
Did you try
assume(q[1][2] = q[2][1])
Also, when you defined q, did you try giving it parameters for special properties such as Symmetric ?
  댓글 수: 1
yogesh
yogesh 2013년 10월 25일
편집: yogesh 2013년 10월 25일
Thanks for your reply. I tried the following :
assume (q[1][2] = q[2][1])
aa := sum(sum(q[i][j],i=1..2),j=1..2)
which gives
q[1][1] + q[1][2] + q[2][1] + q[2][2]
I also tried
aa := sum(sum(q[i][j],i=1..2),j=1..2) assuming (q[1][2] = q[2][1])
But the result is same as before. To be more clear, what I want to do is to specify certain symmetry conditions for terms in the series involving 3 or 4 summation indexes. The total number of terms comes to around 80, so it's not easy to specify the symmetry conditions manually (which don't seem to work as seen above).
What would you suggest? Thanks for the help.
-yogesh

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MuPAD에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by