Trigonometric functions: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added syntax colouring the hard way, phix/basics) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 16: | Line 16: | ||
If your language does not have trigonometric functions available or only has some available, write functions to calculate the functions based on any [[wp:List of trigonometric identities|known approximation or identity]]. |
If your language does not have trigonometric functions available or only has some available, write functions to calculate the functions based on any [[wp:List of trigonometric identities|known approximation or identity]]. |
||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
{{trans|Python}} |
|||
<lang 11l>V rad = math:pi / 4 |
|||
V deg = 45.0 |
|||
print(‘Sine: ’sin(rad)‘ ’sin(radians(deg))) |
|||
print(‘Cosine: ’cos(rad)‘ ’cos(radians(deg))) |
|||
print(‘Tangent: ’tan(rad)‘ ’tan(radians(deg))) |
|||
V arcsine = asin(sin(rad)) |
|||
print(‘Arcsine: ’arcsine‘ ’degrees(arcsine)) |
|||
V arccosine = acos(cos(rad)) |
|||
print(‘Arccosine: ’arccosine‘ ’degrees(arccosine)) |
|||
V arctangent = atan(tan(rad)) |
|||
print(‘Arctangent: ’arctangent‘ ’degrees(arctangent))</lang> |
|||
{{out}} |
|||
<pre> |
|||
Sine: 0.707106781 0.707106781 |
|||
Cosine: 0.707106781 0.707106781 |
|||
Tangent: 1 1 |
|||
Arcsine: 0.785398163 45 |
|||
Arccosine: 0.785398163 45 |
|||
Arctangent: 0.785398163 45 |
|||
</pre> |
|||
=={{header|ACL2}}== |
=={{header|ACL2}}== |