## 15 Reputation

10 years, 352 days

## how the function if work?...

Maple 14

Hi

I have a problem why the result does not appear..my code are:

> P := array([[8, 4], [8, 3], [8, 2], [7, 1], [6, 0], [5, 0], [4, 0], [2, 1], [1, 1], [1, 4]]);

> for j from 2 to 5 do k[j] := j+1;

x[j] := add(P[j, 1], j = j-1 .. j+2);

X[j] := add(P[j, 1]^2, j = j-1 .. j+2);

y[j] := add(P[j, 2], j = j-1 .. j+2);

Y[j] := add(P[j, 2]^2, j = j-1 .. j+2);

xy[j] := add(P[j, 1]*P[j, 2], j = j-1 .. j+2);

cx[j] := evalf(x[j]/k[j]);

cy[j] := evalf(y[j]/k[j]);

c11[j] := evalf(X[j]/k[j]-cx[j]^2);

c22[j] := evalf(Y[j]/k[j]-cy[j]^2);

c12[j] := evalf(xy[j]/k[j]-cx[j]*cy[j]);

C[j] := evalf(Matrix(2, 2, [[c11[j], c12[j]], [c12[j], c22[j]]]));

E[j] := Eigenvalues(C[j]);

if E[j][1] > E[j][2] then lambda[j] := E[j][2]/(E[j][1]+E[j][2]) else lambda[j] := E[j][1]/(E[j][1]+E[j][2])

end if;

end do;

the If function does not work and the result does not appear. Is there any problem in my code.

Thanks

Maple 14

## how to sort a coordinate points...

Maple 14

hi everyone,

I have a list of coordinates  and would like to sort them so that in the new order, the last coordinate will be the first coordinate and the first coordinate will be the first:

for example:

P:=array([[1,4],[2,3],[3,2],[4,1],[6,5],[6,1]]):

should sort to

P:=array[ [6,1], [6,5], [4,1],[3,2],[2,3],[1,4]]

## combination of for-loop and while-loop.....

Maple 14

Hi,

I wondered if you would be able to help.

I've set up a for-loop and while-loop that substitutes values of j and k into a given function

I want to get the answer for every right for example right[1], right[2]..but this code give the answer for right[1]nd right[6] only..

P := array([[1, 4], [2, 3], [3, 2], [4, 1], [6, 5], [6, 1], [6, 2], [5, 3]]);

j := 1; k := j+2; Fold := 0; Fnew := 1; counter := 0;

for...

 1 2 Page 2 of 2
﻿