Trigonometry
Constants
| Symbol | Value |
|---|---|
Degrees | \frac{\pi}{180} = 0.017453292519943295769236907\ldots |
Pi | \pi \approx 3.14159265358979323\ldots |
Trigonometric Functions
| Function | Inverse | Hyperbolic | Area Hyperbolic |
|---|---|---|---|
Sin | Arcsin | Sinh | Arsinh |
Cos | Arccos | Cosh | Arcosh |
Tan | ArctanArctan2 | Tanh | Artanh |
Cot | Arccot | Coth | Arcoth |
Sec | Arcsec | Sech | Arsech |
Csc | Arccsc | Csch | Arcsch |
| Function | |
|---|---|
FromPolarCoordinates | Converts (\operatorname{radius}, \operatorname{angle}) \longrightarrow (x, y) |
ToPolarCoordinates | Converts (x, y) \longrightarrow (\operatorname{radius}, \operatorname{angle}) |
Hypot | \operatorname{Hypot}(x,y) = \sqrt{x^2+y^2} |
Haversine | \operatorname{Haversine}(z) = \sin(\frac{z}{2})^2 The Haversine function was important in navigation because it appears in the haversine formula, which is used to reasonably accurately compute distances on an astronomic spheroid given angular positions (e.g., longitude and latitude). |
InverseHaversine | \operatorname{InverseHaversine}(z) = 2 \operatorname{Arcsin}(\sqrt{z}) |
Trigonometric Simplification
The trigSimplify() method applies the Fu algorithm to simplify trigonometric
expressions. This systematic approach uses transformation rules to find simpler
equivalent forms.
const expr = ce.parse("\\sin^2(x) + \\cos^2(x)");
expr.trigSimplify(); // Returns: 1
const expr2 = ce.parse("2\\sin(x)\\cos(x)");
expr2.trigSimplify(); // Returns: sin(2x)
Alternatively, use the strategy option with simplify():
expr.simplify({ strategy: 'fu' });
Supported Identities
The Fu algorithm recognizes and applies:
- Pythagorean identities:
sin²(x) + cos²(x) = 1,1 + tan²(x) = sec²(x) - Reciprocal identities:
sec(x) = 1/cos(x),csc(x) = 1/sin(x) - Double angle formulas:
sin(2x) = 2sin(x)cos(x),cos(2x) = cos²(x) - sin²(x) - Product-to-sum:
sin(x)cos(y) = ½[sin(x+y) + sin(x-y)] - Sum-to-product:
sin(x) + sin(y) = 2sin((x+y)/2)cos((x-y)/2) - Morrie's law: Products of cosines with doubled angles