The sine function computes the sine of an angle or numeric value. It connects a right triangle's opposing side with its hypotenuse and helps solve practical angle-and-distance problems, such as locating a ship near a lighthouse. section 3.1
Evaluate sine in the REPL
Julia evaluates sine directly with its built-in function: `sin(3.1415926/2)` produces a value close to `1`. The REPL is useful for testing such expressions interactively. section 2.1
You can also build an approximation with a Taylor series. A loop adds successive terms, and the final accumulated value becomes the function result. With five iterations, a custom implementation produces values very close to Julia's built-in `sin`. section 3.4.1
A practical sine workflow includes:
- Evaluate a value with `sin(x)` in the Julia REPL. section 2.1
- Implement an approximation by summing Taylor-series terms in a multiline function. section 3.4.1
- Increase the iteration limit and compare the approximation with the built-in function. section 3.4.1
Figure 3.1 A captain on a ship could use a sextant to measure angle θ between the horizon and top of a lighthouse.
Use the sextant-and-lighthouse scene to connect sine with measuring angles and determining distance at sea. section 3.1


