calc: Unsafe Simplifications

 
 11.3.3 “Unsafe” Simplifications
 -------------------------------
 
 Calc is capable of performing some simplifications which may sometimes
 be desired but which are not “safe” in all cases.  The ‘a e’
 (‘calc-simplify-extended’) [‘esimplify’] command applies the algebraic
 simplifications as well as these extended, or “unsafe”, simplifications.
 Use this only if you know the values in your formula lie in the
 restricted ranges for which these simplifications are valid.  You can
 use Extended Simplification mode (‘m E’) to have these simplifications
 done automatically.
 
    The symbolic integrator uses these extended simplifications; one
 effect of this is that the integrator’s results must be used with
 caution.  Where an integral table will often attach conditions like “for
 positive ‘a’ only,” Calc (like most other symbolic integration programs)
 will simply produce an unqualified result.
 
    Because ‘a e’’s simplifications are unsafe, it is sometimes better to
 type ‘C-u -3 a v’, which does extended simplification only on the top
 level of the formula without affecting the sub-formulas.  In fact, ‘C-u
 -3 j v’ allows you to target extended simplification to any specific
 part of a formula.
 
    The variable ‘ExtSimpRules’ contains rewrites to be applied when the
 extended simplifications are used.  These are applied in addition to
 ‘EvalRules’ and ‘AlgSimpRules’.  (The ‘a r AlgSimpRules’ step described
 above is simply followed by an ‘a r ExtSimpRules’ step.)
 
    Following is a complete list of the “unsafe” simplifications.
 
    Inverse trigonometric or hyperbolic functions, called with their
 corresponding non-inverse functions as arguments, are simplified.  For
 example, ‘arcsin(sin(x))’ changes to ‘x’.  Also, ‘arcsin(cos(x))’ and
 ‘arccos(sin(x))’ both change to ‘pi/2 - x’.  These simplifications are
 unsafe because they are valid only for values of ‘x’ in a certain range;
 outside that range, values are folded down to the 360-degree range that
 the inverse trigonometric functions always produce.
 
    Powers of powers ‘(x^a)^b’ are simplified to ‘x^(a b)’ for all ‘a’
 and ‘b’.  These results will be valid only in a restricted range of ‘x’;
 for example, in ‘(x^2)^1:2’ the powers cancel to get ‘x’, which is valid
 for positive values of ‘x’ but not for negative or complex values.
 
    Similarly, ‘sqrt(x^a)’ and ‘sqrt(x)^a’ are both simplified (possibly
 unsafely) to ‘x^(a/2)’.
 
    Forms like ‘sqrt(1 - sin(x)^2)’ are simplified to, e.g., ‘cos(x)’.
 Calc has identities of this sort for ‘sin’, ‘cos’, ‘tan’, ‘sinh’, and
 ‘cosh’.
 
    Arguments of square roots are partially factored to look for squared
 terms that can be extracted.  For example, ‘sqrt(a^2 b^3 + a^3 b^2)’
 simplifies to ‘a b sqrt(a+b)’.
 
    The simplifications of ‘ln(exp(x))’, ‘ln(e^x)’, and ‘log10(10^x)’ to
 ‘x’ are also unsafe because of problems with principal values (although
 these simplifications are safe if ‘x’ is known to be real).
 
    Common factors are canceled from products on both sides of an
 equation, even if those factors may be zero: ‘a x / b x’ to ‘a / b’.
 Such factors are never canceled from inequalities: Even the extended
 simplifications are not bold enough to reduce ‘a x < b x’ to ‘a < b’ (or
 ‘a > b’, depending on whether you believe ‘x’ is positive or negative).
 The ‘a M /’ command can be used to divide a factor out of both sides of
 an inequality.