필터 지우기
필터 지우기

Negative index of matrix

조회 수: 1 (최근 30일)
Burak
Burak 2016년 8월 4일
댓글: Walter Roberson 2016년 8월 5일
Hi , I am trying to calculate gaunt coefficients for μ=-m. But I am stuck with negative index of matrix calculation.If anyone can help me I'll appreciate. Thanks for your help.
here is my code.
% clc
clear all
N_cut=2;
for n=1:N_cut
for m=-n:n
for v=m:N_cut
for p=abs(n-v):2:n+v
a(n,m,v,p+1)=(2*p+1)*sqrt((factorial(n+m)*factorial(v-m))/(factorial(n-m)*factorial(v+m)))*...
Wigner3j(n,v,p,0,0,0)*Wigner3j(n,v,p,m,-m,0);
end
end
end
end

답변 (1개)

Walter Roberson
Walter Roberson 2016년 8월 4일
  댓글 수: 1
Walter Roberson
Walter Roberson 2016년 8월 5일
To expand: any time your indices are not consecutive integers starting from 1, you can use this pattern:
m_vals = -m:m; %vector of the allowed values
for m_idx = 1 : length(m_vals)
m = m_vals(m_idx);
....
a(n,m_idx,v,p+1) = ....
end
That is, you create a vector with the values, loop over the indices of that vector, set your variable of interest to the vector indexed at the index variable, and when you go to store the value use the index variable.
You do, however, have to watch out for the problem that your values might line up with each other, since your -m:m will vary in size as n changes. Your formula is for the calculation of a particular set of 4 inputs but you are trying to calculate it over an irregular region, and you are trying to store that irregular region into a rectangular hypercube. The location within the hypercube that you store the irregular region is not well defined in what you posted.

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

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by