Board index » delphi » Plotting a Sin graph

Plotting a Sin graph

Hi there,
Thanks once again to everyone for their help.

We started doing Sin graphs this year, but I can't plot one using
Pascal.  I only tried plotting points untill I can figure out a way to
connect them.  But I have a problem.  Sin(45) equals 0.??? .  How does
one plot that?  I tried multyplying it by 100, but then the points do
not make the normal pattern.  Is there a way to do this?  I know one can
work out the coordinates for all the x values from 1 to 360 by hand and
then store it in an Array, but there has to be an easier way.  Any help
will be appreciated.

Thanks in advance.

Johan Kohler
johan.koh...@als.co.za

 

Re:Plotting a Sin graph


Quote
JOHAN KOHLER wrote:
> We started doing Sin graphs this year, but I can't plot one using
> Pascal.  I only tried plotting points untill I can figure out a way to
> connect them.  But I have a problem.  Sin(45) equals 0.??? .  How does
> one plot that?  I tried multyplying it by 100, but then the points do
> not make the normal pattern.  Is there a way to do this?  I know one
> can work out the coordinates for all the x values from 1 to 360 by
> hand and then store it in an Array, but there has to be an easier way.

Function Sin(<angle in RADIANS>: Real): Real;

Pi radians := 180 degrees

AME

Re:Plotting a Sin graph


 -=> Quoting Alan M  Evans to All <=-

 AME> JOHAN KOHLER wrote:

 > We started doing Sin graphs this year, but I can't plot one using
 > Pascal.  I only tried plotting points untill I can figure out a way to
 > connect them.  But I have a problem.  Sin(45) equals 0.??? .  How does
 > one plot that?  I tried multyplying it by 100, but then the points do
 > not make the normal pattern.  Is there a way to do this?  I know one
 > can work out the coordinates for all the x values from 1 to 360 by
 > hand and then store it in an Array, but there has to be an easier way.

 AME> Function Sin(<angle in RADIANS>: Real): Real;

 AME> Pi radians := 180 degrees

Line 1 I understand - it is the Sin function in TP.  But how do radians work?
Normal degrees go (from top clockwise) 0, 90, 180, 270.  What is the order
for radians?

Thanks in advance.

 Groete uit Suid-Afrika        -              
 Greetings from South Africa   -          Johan Khler
 Salutojn de Sud-Afriko        -          johan.koh...@als.co.za
___ Blue Wave/DOS v2.30 [NR]

Re:Plotting a Sin graph


In article <8D8840D.05F1001B04.uu...@als.co.za>, JOHAN KOHLER
<johan.koh...@als.co.za> writes

Quote
> AME> Function Sin(<angle in RADIANS>: Real): Real;

> AME> Pi radians := 180 degrees

>Line 1 I understand - it is the Sin function in TP.  But how do radians work?
>Normal degrees go (from top clockwise) 0, 90, 180, 270.  What is the order
>for radians?

0   degrees = 0     radians
90  degrees = Pi/2  radians
180 degrees = Pi    radians
270 degrees = 3Pi/2 radians

etc.

1 degree = Pi/180 radians

The reason radians are used, is because, well you know the circumference
of an arc with degrees is (angle/180)*Pi*r

Using radians it's just the angle*radius, which is a hell of a lot
simpler..

Anyway, I don't think this is really relevant right now..

Lots of love
--
,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.
Michael Stephenson      @(^_^)(^_^)@    mich...@jlmaa.demon.co.uk
-+-+*+-+**+-+*+-+-                      http:\\www.jlmaa.demon.co.uk
Proleteri svih zemalja ujedinite se !   PinkFrog on IRC-Net
+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.+'`'+.,.

Re:Plotting a Sin graph


Hi there,

 -=> Quoting Michael Stephenson to All <=-

 MS> 0   degrees = 0     radians
 MS> 90  degrees = Pi/2  radians
 MS> 180 degrees = Pi    radians
 MS> 270 degrees = 3Pi/2 radians

 Thanks a lot for your help.  I have just asked my Computer Studies teacher
 today and that's basically what she came up with.  I will try it and yell
 if I have any more problems :)

 Thanks again.

 Groete uit Suid-Afrika        -              
 Greetings from South Africa   -          Johan Khler
 Salutojn de Sud-Afriko        -          johan.koh...@als.co.za
___ Blue Wave/DOS v2.30 [NR]

Other Threads