Error 148 Dimension different

I have this code, where k is the alias of j. I set j /1*10/

My intention is to write a code which is like this:

for j=1:Jn
for k=1:j
sum = sum + k*(x(k) - x(k-1))
end
end


76 utility … f =e= Insum(j, ((lambda(1 - (sqrt(sum((l,t), power((y(j,
l,t) - (sum(k $ (ord(k) <= ord(j) and ord(k) >= 2), k*(x(k) - x(k-1))) +
**** 148 1*x('1'))/zeta*eta(j,l,t)),2)))/sqrt(sum((l,t), power(y(j,l,t),2)))))) - x(j))*p(j)); 86 limit1b(j,l,t) (ord(j) gt 1) … (sum(k $ (ord(k) <= ord(j) and ord(k)

= 2), k*(x(k) - x(k-1))) + 1*x(‘1’))/zeta =l= y(j,l,t) ;
**** $148

Why does this error occur?

Hi
You are multiplying with a set element

 k*(x(k) - x(k-1))

Set elements are not numbers, even if you define the set as consisting of numbers. To multiply with the value of an element of a set k you can use k.val (if k has numbers as elements) or ord(k) if the set elements are strings.

 k.val*(x(k) - x(k-1))

Cheers
Renger

Thank you a lot, Renger!