Question: How to program a for loop inside a procedure and make an expanding list?

I'm trying to program a procedure that will return me a list of positions defining equally spaced points (planets) around a circumference, for example:
PSI := [0, Pi]; # Location of 2 planets
PSI := [0, ((2/3)*Pi) , ((4/3)*Pi) ]; # For 3 Planets
I'm new to maple so most commands are new to me, I tried building the size of the list with [0 $ n] because I want the first position to always be at 0 degrees. The first problem is that I get this error:

Error, reserved word `for` unexpected

 

nplanets := 2;

2

(1)

make_PSI :=
proc(nplanets);
local n,psin,i,PSI:
n = nplanets;
psin  :=(pi*2)/n;
PSI := [0 $ n];
for i from 1 to n do
 angle :=(psin*i);
 op(i,PSI) := angle;
end do;
end;

 

 

Error, reserved word `for` unexpected

 


Any advice would be appreciated!

Download planetspace.mw

Please Wait...