Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'need help from the experts' topicStudent Support Forum > General > Archives > "need help from the experts"

Next Comment >Help | Reply To Topic
Author Comment/Response
kaizen
08/24/11 04:45am

[Different from http://forums.wolfram.com/student-support/topics/26392 - Forum Moderator]

Dear all,

Please help me to fix this problem:

f[m_,n_]:=Module[{u1, u2, v1, v2, sumu1, sumu2,sumv1, sumv2}, u1 = 3 m + 2 n;u2 = 2 m - 5 n; v1 = 4 m - 3 n; v2 = 6 m + 3 n; sumu1 = Sum[u1[i, n], {i, 1, m, 2}]; sumu2 = Sum[u2[i, n], {i, 1, m, 2}]; sumv1 = Sum[v1[m, j], {j, 1, n, 2}]; sumv2 = Sum[v2[m, j], {j, 1, n, 2}] {sumu1, sumu2, sumv1, sumv2}];

Do[f[m, n]; Print[f[m, n]], {m, 1, 3, 2}, {n, 1, 3, 2}]

Definitions: the idea is that sumu1(1,1) = u1(1,1); sumu1(1,3) = u1(1,3); sumu1(3,1) = u1(1,1) + u1(3,1); sumu1(3,3) = u1(1,3) + u1(3,3)

and for sumu2(1,1) = u2(1,1); sumu2(1,3) = u2(1,3); sumu2(3,1) = u2(1,1) + u2(3,1); sumu2(3,3) = u2(1,3) + u2(3,3)

However for sumv1(1,1) = v1(1,1); sumv1(1,3) = v1(1,1) + v1(1,3); sumv1(3,1) = v1(3,1) ; sumv1(3,3) = v1(3,1) + v1(3,3)

and similarly for sumv2(1,1) = v2(1,1); sumv2(1,3) = v2(1,1) + v2(1,3); sumv2(3,1) = v2(3,1) ; sumv2(3,3) = v2(3,1) + v2(3,3)


The correct answers I should be getting from the Do-loop are:

f(1,1) = { 5, -3 , 1 , 9}
f(1,3) = { 9 , -13 , -4 , 24 }
f(3,1) = {15 , -2 , 11 , 19 }
f(3,3) = { 24 , -22 , -2 , 42 }

Thank you for any kind help.


URL: ,

Subject (listing for 'need help from the experts')
Author Date Posted
need help from the experts kaizen 08/24/11 04:45am
Re: need help from the experts yehuda 08/25/11 7:56pm
Next Comment >Help | Reply To Topic