Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have the two variables L,m such that
L=,0 => m=0
L=1 =>m=-1,0,1
L=2 =>m = -2,-1,0,1,2
(for each value of L, m is from -L to +L with increment 1)

now I want to generate a list with the order like
list= {{0,0},{1,0},{2,0},{1,-1},{2,-1},{1,1},{2,1},{2,-2},{2,2}}//
//all values of L for m=0
all values of L for m=-1
all values of L for m=1
all values of L for m=-2
all values of L for m=2
What should be the code for this list? kindly help and sorry for mistake in the text
Posted
Comments
Philippe Mori 16-Mar-14 19:53pm    
The explanation could be a bit more clear... With all those 0, 1 and 2, it is a bit hard to figure out from were the numbers come from...

Also, you don't specify the language. The easiest way is to use 3 nested loops. One for absolute value of m (from 0 to Lmax inclusively), a second loop for the sign (skip negative case for 0) and a third loop for each value of L. That third loop would start at the index given by the current index of outer loop.
Member 10674890 17-Mar-14 1:57am    
for a given value of n (n>=0)
L=0,1,2,.......n-1
m=-L, -L+1,-L+2,........L //(2L +1 values of m)
(For n=3 we have L=0,1,2 and m=-2,-1,0,1,2)
Also I am using mathematica.
I hope this time it may better

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900