This is likely my error but I cannot see it. I define a vector:
x1 = {{{2, 2}}, {{2, 1}, {3, 1}}, {{3, 2}}, {{2, 1}, {5, 1}}}
If x1[[ i, 1,2]] is 2, I would like to find $(\log$ x1[[ i,1,1]]$^2$).
If x1[[ i, 1, 2]] is 1, I would like to find $(\log$ x1[[ i,1,1]]$\cdot \log $x1[[ i, 2,1]] ).
There are 4 elements of x1 and I would like to add the total of the log expressions for i = 1 to i = 4.
My code more or less was:
(i = 0; Label[A]; i++;
If [ x1[[ i, 1, 2]] = 2, b2 = Log[ x1[[ i, 1, 1]]]^2 + b1,
b2 = Log[ x1[[ i, 1, 1]]]*Log[ x1[[ i, 2, 1]]] + b1]; b1 = b1 + b2;
If [ i < 6, Goto[A], Goto[B]]; Label[B]; )
Any suggestions for getting this to work? I will be out for a bit but thanks for any help.
Goto[]
outside compiled functions in this site. Perhaps you should revise the programming paradigm you're trying to use. I suggest you may start by reading the answers here and then do a recreational trip through the highest voted questions and answers to get a grip on better Mathematica programming practices. $\endgroup$Sum[#1 ((2 - #2) #3 + (#2 - 1) #1) &[Log[x1[[i, 1, 1]]], x1[[i, 1, 2]], Log[x1[[i, 2, 1]]]], {i, 4}]
$\endgroup$