Student Support Forum: 'looping inside the Module' topicStudent Support Forum > General > "looping inside the Module"

 Next Comment > Help | Reply To Topic
 Author Comment/Response kaizen 10/24/11 05:29am Dear all, I have difficulty to solve this code which involves looping, In [1] := m = 1; n = 1 ; A = -1 ; B = 5 ; In [2] := m = 1; n = 3 ; A = 8 ; B = -2 ; In [3] := m = 1; n = 5 ; A = 9 ; B = 7 ; In [4] := m = 3; n = 1 ; A = -2 ; B = 8 ; In [5] := m = 3; n = 3 ; A = 4 ; B = 3 ; In [6] := m = 3; n = 5 ; A = 9 ; B = -1 ; In [7] := m = 5; n = 1 ; A = 6 ; B = 9 ; In [8] := m = 5; n = 3 ; A = 2 ; B = 1 ; In [9] := m = 5; n = 5 ; A = 3 ; B = -7 ; Method 1: In [10] := qsolve := Module[{mat, A, B, m, n}, Table[mat = A + B, {m, 1, 5, 2}, {n, 1, 5, 2}]] Method 2: In [11] := qsolve := Module[{mat, A, B, m, n}, Clear[mat,A,B]; Do[mat = A + B; Print[mat], {m, 1, 5, 2}, {n, 1, 5, 2}]] I have tried to use both method1 and method2 but still failed. Iam expecting the answer to be {4,6,16},{6,7,8},{15,3,-4} Please let me know how to fix this code. Many thanks for any help. URL: ,

 Subject (listing for 'looping inside the Module') Author Date Posted looping inside the Module kaizen 10/24/11 05:29am Re: looping inside the Module Peter Pein 10/25/11 03:55am
 Next Comment > Help | Reply To Topic