Template:Sin
From Wikipedia, the free encyclopedia
Implements the mathematical sine function, from an input in radians, with an output precision of 4 decimals.
For the value of pi, you can use 3.14159265358979.
- Usage:
- {{Sin|radians}}
- Limitations
- Don't use this template to create complex graphics! It will rapidly exhaust server resources if you instanciate it too many times. This template is intended only to compute very few trigonometric functions per page!
- The limitation of the precision to 4 decimals avoids an output in scientific notation like "1E-5", which may generate errors if the result is used in another expression (because the ParserFunction #expr still does not support such numbers on input).
- Examples:
sin(- π )
= 0sin(-5π/6)
= -0.5sin(-3π/4)
= -0.7071sin(-2π/3)
= -0.866sin(- π/2)
= -1sin(- π/3)
= -0.866sin(- π/4)
= -0.7071sin(- π/6)
= -0.5sin( 0 )
= 0sin(0.00001)
= 0 (rounded to 4 decimals)sin(0.0001)
= 0.0001sin( π/6)
= 0.5sin( π/4)
= 0.7071sin( π/3)
= 0.866sin( π/2)
= 1sin( 2π/3)
= 0.866sin( 3π/4)
= 0.7071sin( 5π/6)
= 0.5sin( π )
= 0sin( 3π/2)
= -1sin( 2π )
= 0sin( 5π/2)
= 1sin( 3π )
= 0sin( 7π/2)
= -1sin( 4π )
= 0- More complex example:
<div style="position:relative;width:600px;height:600px;font-family:serif;border:1px solid black"> <div style="position:absolute;bottom:{{#expr:{{sin|0}}*200+300}}px;left:{{#expr:{{cos|0}}*200+300}}px">• 0</div> <div style="position:absolute;bottom:{{#expr:{{sin|3.141592/6}}*200+300}}px;left:{{#expr:{{cos|3.141592/6}}*200+300}}px">• π/6</div> <div style="position:absolute;bottom:{{#expr:{{sin|3.141592/4}}*200+300}}px;left:{{#expr:{{cos|3.141592/4}}*200+300}}px">• π/4</div> <div style="position:absolute;bottom:{{#expr:{{sin|3.141592/3}}*200+300}}px;left:{{#expr:{{cos|3.141592/3}}*200+300}}px">• π/3</div> <div style="position:absolute;bottom:{{#expr:{{sin|3.141592/2}}*200+300}}px;left:{{#expr:{{cos|3.141592/2}}*200+300}}px">• π/2</div> <div style="position:absolute;bottom:{{#expr:{{sin|11*3.141592/6}}*200+300}}px;left:{{#expr:{{cos|11*3.141592/6}}*200+300}}px">• 11π/6</div> <div style="position:absolute;bottom:{{#expr:{{sin|7*3.141592/4}}*200+300}}px;left:{{#expr:{{cos|7*3.141592/4}}*200+300}}px">• 7π/4</div> <div style="position:absolute;bottom:{{#expr:{{sin|5*3.141592/3}}*200+300}}px;left:{{#expr:{{cos|5*3.141592/3}}*200+300}}px">• 5π/3</div> <div style="position:absolute;bottom:{{#expr:{{sin|3*3.141592/2}}*200+300}}px;left:{{#expr:{{cos|3*3.141592/2}}*200+300}}px">• 3π/2</div> <div style="position:absolute;bottom:{{#expr:{{sin|4*3.141592/3}}*200+300}}px;left:{{#expr:{{cos|4*3.141592/3}}*200+300}}px">• 4π/3</div> <div style="position:absolute;bottom:{{#expr:{{sin|5*3.141592/4}}*200+300}}px;left:{{#expr:{{cos|5*3.141592/4}}*200+300}}px">• 5π/4</div> <div style="position:absolute;bottom:{{#expr:{{sin|7*3.141592/6}}*200+300}}px;left:{{#expr:{{cos|7*3.141592/6}}*200+300}}px">• 7π/6</div> <div style="position:absolute;bottom:{{#expr:{{sin|3.141592}}*200+300}}px;left:{{#expr:{{cos|3.141592}}*200+300}}px">• π</div> <div style="position:absolute;bottom:{{#expr:{{sin|5*3.141592/6}}*200+300}}px;left:{{#expr:{{cos|5*3.141592/6}}*200+300}}px">• 5π/6</div> <div style="position:absolute;bottom:{{#expr:{{sin|3*3.141592/4}}*200+300}}px;left:{{#expr:{{cos|3*3.141592/4}}*200+300}}px">• 3π/4</div> <div style="position:absolute;bottom:{{#expr:{{sin|2*3.141592/3}}*200+300}}px;left:{{#expr:{{cos|2*3.141592/3}}*200+300}}px">• 2π/3</div> </div>
that will render this trigonometric circle:
• 0
• π/6
• π/4
• π/3
• π/2
• 11π/6
• 7π/4
• 5π/3
• 3π/2
• 4π/3
• 5π/4
• 7π/6
• π
• 5π/6
• 3π/4
• 2π/3
- See also: