simplify constant expressions typically containing radicals and functions with exact numeric arguments
literal name; constant
The simplify(expr, constant) calling sequence is used to simplify expressions that are of type,constant and typically contain radicals or mathematical functions having exact numeric arguments.
The approach used consists of applying a set of simplification procedures (SP) in two steps:
1) The constant objects, in the form of sums, products, or function calls, are simplified using SP, starting with the inner most one and composing simplifications at each step. The routines can handle with reasonable efficiency products of fractional powers, exponentials, and various functions calls together with their multiplicative inverses.
2) When the resulting expression still contains radicals, the simplification procedure applied to each object in the previous step is applied once more, this time to the whole expression.
The simplification procedures SP used in the itemization above consist of analyzing the Real and Imaginary parts of the expression in order to conclude about possible cancellations or simpler representations. In addition, if the expression or subexpression can be evaluated numerically fast, using hardware floats, this information is used as a starting point to determine an exact rational value for the object, if that value exists.
The simplify/constant routines do take assumptions into account up to the point Re, Im, and abs take them.
The simplification of constant subexpressions entering input for simplify is performed automatically. However, to invoke this set of simplification routines, call simplify with the extra argument constant.
e1 ≔ 1+2⁢cos⁡2⁢Pi7−2⁢cos⁡3⁢Pi7−2⁢cos⁡1⁢Pi7
How it works.
The following example has a more complex step.
e2 ≔ −167−−117+−147+−127−−137+1−−157
Here evalc determines that the expression is real but does not perform the full simplification.
simplify/constant is able to simplify further to obtain 0.
This example shows that these simple manipulations of the real and imaginary parts are not enough, but the expression is (in this case by construction) equal to a rational number.
e3 ≔ e2−1753
The following example has nonelementary functions.
e4 ≔ 1⁢Ψ⁡1,18⁢Pi⁢csc⁡1⁢Pi864⁢GAMMA⁡78+1⁢Ψ⁡182⁢Pi⁢csc⁡1⁢Pi864⁢GAMMA⁡78−1⁢Pi⁢Ψ⁡1,1864⁢sin⁡1⁢Pi8⁢GAMMA⁡78−1⁢Pi⁢Ψ⁡18264⁢sin⁡1⁢Pi8⁢GAMMA⁡78+1
The following example has powers of trigonometric functions.
e5 ≔ −1200⁢cos⁡3⁢Pi72⁢cos⁡1⁢Pi77+128⁢cos⁡3⁢Pi767−4⁢cos⁡3⁢Pi7⁢120⁢cos⁡3⁢Pi7⁢cos⁡1⁢Pi7−192⁢cos⁡3⁢Pi757−1200⁢cos⁡2⁢Pi72⁢cos⁡3⁢Pi77+128⁢cos⁡2⁢Pi767+4⁢cos⁡2⁢Pi7⁢−120⁢cos⁡3⁢Pi7⁢cos⁡2⁢Pi7+192⁢cos⁡2⁢Pi757+1200⁢cos⁡2⁢Pi7⁢cos⁡1⁢Pi727+128⁢cos⁡1⁢Pi767−4⁢cos⁡1⁢Pi7⁢−120⁢cos⁡1⁢Pi7⁢cos⁡2⁢Pi7−192⁢cos⁡1⁢Pi757
In cases as the following one (extracted from some integration problems):
e6 ≔ −1⁢I⁢ⅇI⁢Ei⁡1,I2−1⁢Ei⁡1,I⁢sin⁡12+1⁢I⁢Ei⁡1,I⁢cos⁡12−1⁢Ei⁡1,−I⁢sin⁡12−1⁢I⁢Ei⁡1,−I⁢cos⁡12+1⁢I⁢ⅇ−I⁢Ei⁡1,−I2
The whole expression cannot be simplified by means of Re, Im
It cannot be evaluated using hardware floats.
Error, unsupported type `indexed` in evalhf
Some subexpressions of it can be simplified by properly manipulating these procedures and that suffices to collapse the original problem into something within the scope of these simpler manipulations, here leading to the following.
The simplification routines for constant expressions is also used by simplify to simplify certain type of constant subexpressions found inside non-constant expressions
e7 ≔ 1⁢212⁢−4⁢1+21212+2⁢2⁢212−212⁢Pi+2⁢212−212⁢Pi⁢212+2⁢Pi12⁢2⁢212−212+Pi12⁢212⁢2⁢212−212+2⁢x⁢2⁢212−212+x⁢212⁢2⁢212−2122⁢2⁢212−212⁢212−1⁢1+2122
Download Help Document
What kind of issue would you like to report? (Optional)