Mathematica has tons of functions to perform algebraic manipulations. But is there a way to use it to check if I didn't make mistakes in my own algebraic manipulations.
As a real world example:
- [step1] I have $\sin(\omega t + \pi /2)$
- [step2] I rewrite that as $\sin(\omega t - \pi/4 +3\pi /4)$,
- [step3] I apply a well known identity so I end up with $\sin(\omega t - \pi/4)\cos(3\pi /4) + \cos(\omega t - \pi/4)\sin(3\pi /4)$.
Will Mathematica be able to check: $$\text{step1}\Leftrightarrow\text{step2}\Leftrightarrow\text{step3}$$ I don't look for something smart, just verifying I didn't make a sign error or something like that.
Cos[a +b]
in your expression, then useTrigExpand
. E.g.TrigExpand@Cos[a + b]
returns the identity you sought. See alsoTrigReduce
etc. $\endgroup$TrigExpand[Sin[\[Omega] t -a + b]]
will perform a full expansion of the expression, which was not something I wanted. $\endgroup$Simplify[step1-step3]
? OrFullSimplify
. When that doesn't work, I plug in random numbers with something likeexpr1 - expr2 /. x -> RandomReal[{-10, 10}, 1, WorkingPrecision -> 32]
, depending on what domain I want instead of{-10, 10}
, how many variables there are, whether the expressions are listable. If listable, it's easy to check 100 random values with... /. Thread[{x, y, z} -> RandomReal[{-2,2}, {3, 100}, WorkingPrecision -> 32]
. $\endgroup$==
instead of a difference. I assume your solution is better suited to deal with rounding errors. $\endgroup$