TrigFactor
The factoring counterpart of TrigExpand/TrigReduce — rewrites sums and differences of Sin/Cos into products.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
TrigFactor!Typed signatures
| Type | Package | Applies |
|---|---|---|
(expression) -> expression | analytic | always |
Details
- Two independent strategies, tried in order: (1) the four sum-to-product identities (, ) and the two half-angle identities (), matched structurally (each confirmed against
wolframscript's ownTrigFactor, up to reordering); (2) failing that, ifexpris a genuine polynomial inSin(x0)/Cos(x0)for one common argumentx0(Add/Subtract/Negate/Multiply/an integerPowerover those two atoms andx0-free numeric coefficients), substituteu = Sin(x0),v = Cos(x0), factor the polynomial inu,vwith compute-engine's ownFactor, and substitute back. - The polynomial strategy is provably correct (whatever
Factorreturns for the polynomial IS one, so re-substituting reconstructs the identity) but does not chase the extra trig identities Wolfram's ownTrigFactorsometimes prefers — e.g. it rewrites as rather than the plain difference-of-squares this file gives; both are correct identities, just not the same factorization. - Declined: two DIFFERENT trig arguments mixed together outside the four named pairs (e.g. ), any transcendental other than Sin/Cos, and an argument-dependent (non-integer) exponent.
Examples
Scope #
About
| Examples | 6 |
|---|---|
| Checked against | Wolfram Language 5 agree1 differ |
| Crosswalk | Wolfram Language |
Implementation
primitive · kernela kernel — an algorithm over mutable state that would not be readable as a tree
nativeengine
typescriptpackages/symbols/analysis/analytic/src/trig-factor.ts See also: ExpToTrig, FunctionExpand