liveBook · Manning

Cosine function

Also called cos

The cosine function is a periodic trigonometric function that maps a real number or angle to a value between −1 and 1.

How 3 Manning books explain it

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.

Read how Math for Web Design explains cosine function →

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

What to know first

Related concepts

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.