Too many ")'' and ')' expected

Hi!
I did not find where is the mistake of my syntax about ‘)’

I want to calculate such as below.
assume r(k) = sqrt(sum(j,(DF(k-ord(j))-X(k-ord(j)))**2)/ord(k-1)), I want to set like this.
r(5)=sqrt((DF(1)-X(1))**2+(DF(2)-X(2))**2+(DF(3)-X(3))**2+(DF(4)-X(4))**2/4
r(4)=sqrt((DF(1)-X(1))**2+(DF(2)-X(2))**2+(DF(3)-X(3))**2/3
r(3)=sqrt((DF(1)-X(1))**2+(DF(2)-X(2))**2/2
r(2)=sqrt((DF(1)-X(1))**2
so I code as below.

AA(k-1)..DU(k)=e=DF(k)+z1*sqrt(sum(j,(DF(k-ord(j))-X(k-ord(j)))**2)/ord(k-1));

However, the error said that ‘)’ expected and too many’)’ for this code.

I appreciated your help!

Hi
You can write ord(k-1). This should be (ord(k) - 1). If you change your code accordingly, the message disappears.
Cheers
Renger