Karim BELABAS on Tue, 30 Mar 1999 14:07:59 +0200 (MET DST)

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 Re: drawing right N-gons

```[Igor:]
> I need to be able to draw right N-gons in PARI.
>
> Here's the steps I do
>
> 1) using polroots(), obtain a vector of Nth roots of unity:
> v=polroots(x^N-1)
> 2) Sort the list by arg():
> ( I wrote a simple function to do that )
> 3) Draw:
> psplothraw(real(v),imag(v),1)
>
> The only problem with above is that the sheet of paper is rectangular,
> so the image is scaled and I don't get a right N-gon.
>
> So my question is how can I scale, so that I get a right N-gon?

Hum. Can't do it directly I'm afraid:

Nth(N) = vector(N+1, k, exp(2*I*Pi*k/N))

plotinit(0,800,800);
plotscale(0,-1,1,-1,1);

v = Nth(17);
plotlines(0, real(v), imag(v));
plotdraw([0,0,0]);

(you'll have to draw the bounding box/axis yourself)

Karim.
__
Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
--