Cosine function
The cosine function is a periodic trigonometric function that maps a real number or angle to a value between −1 and 1.
Math for Web Design
cos() is a CSS mathematical function that returns the cosine of an angle.
- How it is used
- Positions elements horizontally on circular layouts and drives oscillating angles for a swinging animation.
- How deep it goes
- Defines the triangle ratio and unit-circle coordinate, then works through CSS and JavaScript placement and a pendulum calculation.
- Examples
- Uses a six-item circular menu in CSS and JavaScript and a JavaScript swinging-sign animation.
- What you can do after
- Build it from scratch: calculate circular menu positions with CSS cos() or JavaScript Math.cos(), and animate a cosine-driven swing.
Julia as a Second Language
cos is a Julia function that computes the cosine of an angle or numeric value.
- How it is used
- Uses cosine to turn measured angles into values for navigation and other triangle-based calculations.
- How deep it goes
- Explains cosine through navigation, then implements unit-aware methods and conversions without developing a cosine approximation.
- Examples
- Uses lighthouse navigation, sextant angle measurement, Radian and DMS types, and unit-aware cos calls.
- What you can do after
- Apply it via Julia’s cos methods to calculate values while making radians or degrees explicit.
Read how Julia as a Second Language explains cosine function →
D3.js in Action, Third Edition
Cosine is a trigonometric function that gives the ratio of the adjacent side to the hypotenuse in a right triangle.
- How it is used
- Positions vertical coordinates for radial SVG axes in a month-based visualization.
- How deep it goes
- Defines the right-triangle ratio and works through coordinate equations, without developing broader trigonometric theory.
- Examples
- Uses a circle with twelve month axes, angle calculations, and SVG line endpoints as concrete artifacts.
- What you can do after
- Build radial SVG axes by converting angles and radii into vertical endpoint coordinates.
Read how D3.js in Action, Third Edition explains cosine function →
Also covered in
- Building Quantum Software with Python
- Geometry for Programmers
- Get Programming: Learn to code with Python
What to know first
- angleAn angle is a geometric measure of rotational separation between two rays, directions, or vectors sharing a common origin.
- degreesA degree is a unit of angular measurement equal to one three-hundred-sixtieth of a full revolution.
- radianA radian is an angular unit defined by the angle at a circle’s center subtended by an arc whose length equals the circle’s radius.
Related concepts
- rotationused by · A rotation is a geometric transformation that turns points or objects around a fixed point or axis by an angle while preserving distances and angles.
- positional embeddingused by · A positional embedding is a numerical representation associated with an element’s position in a sequence and incorporated into its representation to convey position or order.
- trigonometrykind of · Trigonometry is the branch of mathematics studying relationships among angles, lengths, geometric ratios, coordinates, and periodic functions.
- operatorkind of · An operator is a symbol, keyword, or language construct that specifies an operation on one or more operands.
- sine functionproduced by · The sine function is a periodic trigonometric function that maps a real number or angle to a value between −1 and 1.
- type-generic macroalternative to · A type-generic macro is a macro-based interface whose expansion selects or adapts operations according to the types of its arguments or associated objects.
Questions about cosine function
What is cosine function?
The cosine function is a periodic trigonometric function that maps a real number or angle to a value between −1 and 1.
Which Manning books explain cosine function?
Math for Web Design, Julia as a Second Language and D3.js in Action, Third Edition.
What should I know before learning cosine function?
Manning books that teach cosine function usually introduce angle, degrees, radian and numeric pi first.
What is the difference between cosine function and type-generic macro?
The cosine function is a periodic trigonometric function that maps a real number or angle to a value between −1 and 1. A type-generic macro is a macro-based interface whose expansion selects or adapts operations according to the types of its arguments or associated objects.
What is cosine function a kind of?
Cosine function is a kind of trigonometry. Trigonometry is the branch of mathematics studying relationships among angles, lengths, geometric ratios, coordinates, and periodic functions.
What is cosine function also called?
Cosine function is also called cos.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


