Trigonometric functions: Difference between revisions

m
→‎{{header|IDL}}: IDL has highlighting
m (→‎{{header|IDL}}: IDL has highlighting)
Line 248:
=={{header|IDL}}==
 
<lang idl>
<pre>
deg = 35 ; arbitrary number of degrees
rad = !dtor*deg ; system variables !dtor and !radeg convert between rad and deg</lang>
<lang idl>; the trig functions receive and emit radians:
</pre><pre>
; the trig functions receive and emit radians:
print, rad, sin(rad), asin(sin(rad))
print, cos(rad), acos(cos(rad))
Line 260 ⟶ 259:
; 0.610865 0.573576 0.610865
; 0.819152 0.610865
; 0.700208 0.610865</lang>
<lang idl>; the hyperbolic versions exist and behave as expected:
</pre><pre>
; the hyperbolic versions exist and behave as expected:
print, sinh(rad) ; etc
 
; outputs
; 0.649572</lang>
<lang idl>;If the input is an array, the output has the same dimensions etc as the input:
</pre><pre>
;If the input is an array, the output has the same dimensions etc as the input:
x = !dpi/[[2,3],[4,5],[6,7]] ; !dpi is a read-only sysvar = 3.1415...
print,sin(x)
Line 275 ⟶ 272:
; 1.0000000 0.86602540
; 0.70710678 0.58778525
; 0.50000000 0.43388374</lang>
<lang idl>; the trig functions behave as expected for complex arguments:
</pre><pre>
; the trig functions behave as expected for complex arguments:
x = complex(1,2)
print,sin(x)
 
; outputs
; ( 3.16578, 1.95960)</lang>
</pre>
 
 
=={{header|J}}==
Anonymous user