Arc Forumnew | comments | leaders | submitlogin
1 point by wgac 5787 days ago | link | parent

Here are definitions of the basic trigonometric functions alternative to the Taylor series. They use complex numbers and Euler's formula. By the way, could someone tell me how to make my code stand out in a comment? Thanks.

(= e 2.71828182845904523539)

(= pi 3.14159265358979323846)

(def sin (x) (/ (- (expt e (* 0+1.i x)) (expt e (* 0-1.i x))) 0+2i))

(def cos (x) (/ (+ (expt e (* 0+1.i x)) (expt e (* 0-1.i x))) 2.0))

(def tan (x) (/ (sin x) (cos x)))

(def cot (x) (/ (cos x) (sin x)))



1 point by thaddeus 5787 days ago | link

I'm assuming when you say 'standout' you mean format/indent your line breaks for code.... for that you add 4 spaces before each line of code. If you mean standout = bold, no clue. T.

-----

1 point by wgac 5787 days ago | link

Thanks.

-----