User Tools

Site Tools


el:cos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

el:cos [2016/01/01 22:38] (current)
Line 1: Line 1:
 +===== Cos =====
  
 +==== Format ====
 +
 +**cos** ( //​expression//​ )
 +
 +==== Description ====
 +
 +Computes the cosine of //​expression//​. //​Expression//​ must be in radians.
 +
 +==== Note ====
 +
 +The cos function does not produce an exact result.
 +
 +==== See Also ====
 +
 +[[acos|Acos]],​ [[asin|Asin]],​ [[atan|Atan]],​ [[degrees|Degrees]],​ [[radians|Radians]],​ [[sin|Sin]],​ [[tan|Tan]]
 +
 +==== Example ====
 +
 +<​code>​
 +clg
 +color black
 +# draw a line across the graphic output
 +line 0,​150,​300,​150
 +# where do we start
 +lastx = 0
 +lasty = cos(0) * 50 + 150
 +# now step across the line and draw
 +for x = 0 to 300 step 5
 +   angle = x / 300 * 2 * pi
 +   y = cos(angle) * 50 + 150
 +   line lastx, lasty, x, y
 +   lastx = x
 +   lasty = y
 +next x
 +</​code>​
 +Draws\\
 +{{cos.jpg|Cosine Curve}}
el/cos.txt ยท Last modified: 2016/01/01 22:38 (external edit)