[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

73.1 Introduction to simplification | ||

73.2 Package absimp | ||

73.3 Package facexp | ||

73.4 Package functs | ||

73.5 Package ineq | ||

73.6 Package rducon | ||

73.7 Package scifac | ||

73.8 Package sqdnst |

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

The directory `maxima/share/simplification`

contains several scripts
which implement simplification rules and functions,
and also some functions not related to simplification.

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

The `absimp`

package contains pattern-matching rules that
extend the built-in simplification rules for the `abs`

and `signum`

functions.
`absimp`

respects relations
established with the built-in `assume`

function and by declarations such
as `modedeclare (m, even, n, odd)`

for even or odd integers.

`absimp`

defines `unitramp`

and `unitstep`

functions
in terms of `abs`

and `signum`

.

`load (absimp)`

loads this package.
`demo (absimp)`

shows a demonstration of this package.

Examples:

(%i1) load (absimp)$ (%i2) (abs (x))^2; 2 (%o2) x (%i3) diff (abs (x), x); x (%o3) ------ abs(x) (%i4) cosh (abs (x)); (%o4) cosh(x)

Categories: Simplification functions · Rules and patterns · Share packages · Package absimp

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

The `facexp`

package contains several related functions that
provide the user with the ability to structure expressions by controlled
expansion. This capability is especially useful when the expression
contains variables that have physical meaning, because it is often true
that the most economical form of such an expression can be obtained by
fully expanding the expression with respect to those variables, and then
factoring their coefficients. While it is true that this procedure is
not difficult to carry out using standard Maxima functions, additional
fine-tuning may also be desirable, and these finishing touches can be
more difficult to apply.

The function `facsum`

and its related forms
provide a convenient means for controlling the structure of expressions
in this way. Another function, `collectterms`

, can be used to add two or
more expressions that have already been simplified to this form, without
resimplifying the whole expression again. This function may be
useful when the expressions are very large.

`load (facexp)`

loads this package.
`demo (facexp)`

shows a demonstration of this package.

Categories: Expressions · Share packages · Package facexp

__Function:__**facsum***(*`expr`,`arg_1`, ...,`arg_n`)Returns a form of

`expr`which depends on the arguments`arg_1`, ...,`arg_n`. The arguments can be any form suitable for`ratvars`

, or they can be lists of such forms. If the arguments are not lists, then the form returned is fully expanded with respect to the arguments, and the coefficients of the arguments are factored. These coefficients are free of the arguments, except perhaps in a non-rational sense.If any of the arguments are lists, then all such lists are combined into a single list, and instead of calling

`factor`

on the coefficients of the arguments,`facsum`

calls itself on these coefficients, using this newly constructed single list as the new argument list for this recursive call. This process can be repeated to arbitrary depth by nesting the desired elements in lists.It is possible that one may wish to

`facsum`

with respect to more complicated subexpressions, such as`log (x + y)`

. Such arguments are also permissible.Occasionally the user may wish to obtain any of the above forms for expressions which are specified only by their leading operators. For example, one may wish to

`facsum`

with respect to all`log`

's. In this situation, one may include among the arguments either the specific`log`

's which are to be treated in this way, or alternatively, either the expression`operator (log)`

or`'operator (log)`

. If one wished to`facsum`

the expression`expr`with respect to the operators`op_1`, ...,`op_n`, one would evaluate`facsum (`

. The`expr`, operator (`op_1`, ...,`op_n`))`operator`

form may also appear inside list arguments.In addition, the setting of the switches

`facsum_combine`

and`nextlayerfactor`

may affect the result of`facsum`

.Categories: Package facexp · Expressions

__Global variable:__**nextlayerfactor**Default value:

`false`

When

`nextlayerfactor`

is`true`

, recursive calls of`facsum`

are applied to the factors of the factored form of the coefficients of the arguments.When

`false`

,`facsum`

is applied to each coefficient as a whole whenever recusive calls to`facsum`

occur.Inclusion of the atom

`nextlayerfactor`

in the argument list of`facsum`

has the effect of`nextlayerfactor: true`

, but for the next level of the expression*only*. Since`nextlayerfactor`

is always bound to either`true`

or`false`

, it must be presented single-quoted whenever it appears in the argument list of`facsum`

.Categories: Package facexp · Expressions

__Global variable:__**facsum_combine**Default value:

`true`

`facsum_combine`

controls the form of the final result returned by`facsum`

when its argument is a quotient of polynomials. If`facsum_combine`

is`false`

then the form will be returned as a fully expanded sum as described above, but if`true`

, then the expression returned is a ratio of polynomials, with each polynomial in the form described above.The

`true`

setting of this switch is useful when one wants to`facsum`

both the numerator and denominator of a rational expression, but does not want the denominator to be multiplied through the terms of the numerator.Categories: Package facexp · Expressions

__Function:__**factorfacsum***(*`expr`,`arg_1`, ...`arg_n`)Returns a form of

`expr`which is obtained by calling`facsum`

on the factors of`expr`with`arg_1`, ...`arg_n`as arguments. If any of the factors of`expr`is raised to a power, both the factor and the exponent will be processed in this way.Categories: Package facexp · Expressions

__Function:__**collectterms***(*`expr`,`arg_1`, …,`arg_n`)If several expressions have been simplified with the following functions

`facsum`

,`factorfacsum`

,`factenexpand`

,`facexpten`

or`factorfacexpten`

, and they are to be added together, it may be desirable to combine them using the function`collecterms`

.`collecterms`

can take as arguments all of the arguments that can be given to these other associated functions with the exception of`nextlayerfactor`

, which has no effect on`collectterms`

. The advantage of`collectterms`

is that it returns a form similar to`facsum`

, but since it is adding forms that have already been processed by`facsum`

, it does not need to repeat that effort. This capability is especially useful when the expressions to be summed are very large.Categories: Package facexp · Expressions

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

Categories: Share packages · Package functs

__Function:__**rempart***(*`expr`,`n`)Removes part

`n`from the expression`expr`.If

`n`is a list of the form`[`

then parts`l`,`m`]`l`thru`m`are removed.To use this function write first

`load(functs)`

.Categories: Package functs · Expressions

__Function:__**wronskian***([*`f_1`, ...,`f_n`],`x`)Returns the Wronskian matrix of the list of expressions [

`f_1`, ...,`f_n`] in the variable`x`. The determinant of the Wronskian matrix is the Wronskian determinant of the list of expressions.To use

`wronskian`

, first`load(functs)`

. Example:(%i1) load(functs)$ (%i2) wronskian([f(x), g(x)],x); (%o2) matrix([f(x),g(x)],['diff(f(x),x,1),'diff(g(x),x,1)])

Categories: Package functs · Differential calculus

__Function:__**tracematrix***(*`M`)Returns the trace (sum of the diagonal elements) of matrix

`M`.To use this function write first

`load(functs)`

.Categories: Package functs · Matrices

__Function:__**rational***(*`z`

)Multiplies numerator and denominator of

`z`by the complex conjugate of denominator, thus rationalizing the denominator. Returns canonical rational expression (CRE) form if given one, else returns general form.To use this function write first

`load(functs)`

.Categories: Package functs · Expressions

__Function:__**logand***(*`x`

,`y`

)Returns logical (bit-wise) "and" of arguments x and y.

To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**logor***(*`x`

,`y`

)Returns logical (bit-wise) "or" of arguments x and y.

To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**logxor***(*`x`

,`y`

)Returns logical (bit-wise) exclusive-or of arguments x and y.

To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**nonzeroandfreeof***(*`x`,`expr`)Returns

`true`

if`expr`is nonzero and`freeof (`

returns`x`,`expr`)`true`

. Returns`false`

otherwise.To use this function write first

`load(functs)`

.Categories: Package functs · Expressions

__Function:__**linear***(*`expr`,`x`)When

`expr`is an expression of the form

where`a`*`x`+`b``a`is nonzero, and`a`and`b`are free of`x`,`linear`

returns a list of three equations, one for each of the three formal variables`b`,`a`, and`x`. Otherwise,`linear`

returns`false`

.`load(antid)`

loads this function.Example:

(%i1) load (antid); (%o1) /usr/share/maxima/5.29.1/share/integration/antid.mac (%i2) linear ((1 - w)*(1 - x)*z, z); (%o2) [bargumentb = 0, aargumenta = (w - 1) x - w + 1, xargumentx = z] (%i3) linear (cos(u - v) + cos(u + v), u); (%o3) false

Categories: Package antid · Expressions

__Function:__**gcdivide***(*`p`,`q`)When the option variable

`takegcd`

is`true`

which is the default,`gcdivide`

divides the polynomials`p`and`q`by their greatest common divisor and returns the ratio of the results.`gcdivde`

calls the function`ezgcd`

to divide the polynomials by the greatest common divisor.When

`takegcd`

is`false`

,`gcdivide`

returns the ratio

.`p`/`q`To use this function write first

`load(functs)`

.See also

`ezgcd`

,`gcd`

,`gcdex`

, and`poly_gcd`

.Example:

(%i1) load(functs)$ (%i2) p1:6*x^3+19*x^2+19*x+6; 3 2 (%o2) 6 x + 19 x + 19 x + 6 (%i3) p2:6*x^5+13*x^4+12*x^3+13*x^2+6*x; 5 4 3 2 (%o3) 6 x + 13 x + 12 x + 13 x + 6 x (%i4) gcdivide(p1, p2); x + 1 (%o4) ------ 3 x + x (%i5) takegcd:false; (%o5) false (%i6) gcdivide(p1, p2); 3 2 6 x + 19 x + 19 x + 6 (%o6) ---------------------------------- 5 4 3 2 6 x + 13 x + 12 x + 13 x + 6 x (%i7) ratsimp(%); x + 1 (%o7) ------ 3 x + x

Categories: Package functs · Polynomials

__Function:__**arithmetic***(*`a`,`d`,`n`)Returns the

`n`-th term of the arithmetic series

.`a`,`a`+`d`,`a`+ 2*`d`, ...,`a`+ (`n`- 1)*`d`To use this function write first

`load(functs)`

.Categories: Package functs · Sums and products

__Function:__**geometric***(*`a`,`r`,`n`)Returns the

`n`-th term of the geometric series

.`a`,`a`*`r`,`a`*`r`^2, ...,`a`*`r`^(`n`- 1)To use this function write first

`load(functs)`

.Categories: Package functs · Sums and products

__Function:__**harmonic***(*`a`,`b`,`c`,`n`)Returns the

`n`-th term of the harmonic series

.`a`/`b`,`a`/(`b`+`c`),`a`/(`b`+ 2*`c`), ...,`a`/(`b`+ (`n`- 1)*`c`)To use this function write first

`load(functs)`

.Categories: Package functs · Sums and products

__Function:__**arithsum***(*`a`,`d`,`n`)Returns the sum of the arithmetic series from 1 to

`n`.To use this function write first

`load(functs)`

.Categories: Package functs · Sums and products

__Function:__**geosum***(*`a`,`r`,`n`)Returns the sum of the geometric series from 1 to

`n`. If`n`is infinity (`inf`

) then a sum is finite only if the absolute value of`r`is less than 1.To use this function write first

`load(functs)`

.Categories: Package functs · Sums and products

__Function:__**gaussprob***(*`x`)Returns the Gaussian probability function

`%e^(-`

.`x`^2/2) / sqrt(2*%pi)To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**gd***(*`x`)Returns the Gudermannian function

`2*atan(%e^x)-%pi/2`

.To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**agd***(*`x`)Returns the inverse Gudermannian function

`log (tan (%pi/4 + x/2)))`

.To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**vers***(*`x`)Returns the versed sine

`1 - cos (x)`

.To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**covers***(*`x`)Returns the coversed sine

`1 - sin (`

.`x`)To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**exsec***(*`x`)Returns the exsecant

`sec (`

.`x`) - 1To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**hav***(*`x`)Returns the haversine

`(1 - cos(x))/2`

.To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**combination***(*`n`,`r`)Returns the number of combinations of

`n`objects taken`r`at a time.To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

__Function:__**permutation***(*`n`,`r`)Returns the number of permutations of

`r`objects selected from a set of`n`objects.To use this function write first

`load(functs)`

.Categories: Package functs · Mathematical functions

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

The `ineq`

package contains simplification rules
for inequalities.

Example session:

(%i1) load(ineq)$ Warning: Putting rules on '+' or '*' is inefficient, and may not work. Warning: Putting rules on '+' or '*' is inefficient, and may not work. Warning: Putting rules on '+' or '*' is inefficient, and may not work. Warning: Putting rules on '+' or '*' is inefficient, and may not work. Warning: Putting rules on '+' or '*' is inefficient, and may not work. Warning: Putting rules on '+' or '*' is inefficient, and may not work. Warning: Putting rules on '+' or '*' is inefficient, and may not work. Warning: Putting rules on '+' or '*' is inefficient, and may not work. (%i2) a>=4; /* a sample inequality */ (%o2) a >= 4 (%i3) (b>c)+%; /* add a second, strict inequality */ (%o3) b + a > c + 4 (%i4) 7*(x<y); /* multiply by a positive number */ (%o4) 7 x < 7 y (%i5) -2*(x>=3*z); /* multiply by a negative number */ (%o5) - 2 x <= - 6 z (%i6) (1+a^2)*(1/(1+a^2)<=1); /* Maxima knows that 1+a^2 > 0 */ 2 (%o6) 1 <= a + 1 (%i7) assume(x>0)$ x*(2<3); /* assuming x>0 */ (%o7) 2 x < 3 x (%i8) a>=b; /* another inequality */ (%o8) a >= b (%i9) 3+%; /* add something */ (%o9) a + 3 >= b + 3 (%i10) %-3; /* subtract it out */ (%o10) a >= b (%i11) a>=c-b; /* yet another inequality */ (%o11) a >= c - b (%i12) b+%; /* add b to both sides */ (%o12) b + a >= c (%i13) %-c; /* subtract c from both sides */ (%o13) - c + b + a >= 0 (%i14) -%; /* multiply by -1 */ (%o14) c - b - a <= 0 (%i15) (z-1)^2>-2*z; /* determining truth of assertion */ 2 (%o15) (z - 1) > - 2 z (%i16) expand(%)+2*z; /* expand this and add 2*z to both sides */ 2 (%o16) z + 1 > 0 (%i17) %,pred; (%o17) true

Be careful about using parentheses
around the inequalities: when the user types in `(A > B) + (C = 5)`

the
result is `A + C > B + 5`

, but `A > B + C = 5`

is a syntax error,
and `(A > B + C) = 5`

is something else entirely.

Do `disprule (all)`

to see a complete listing
of the rule definitions.

The user will be queried if Maxima is unable to decide the sign of a quantity multiplying an inequality.

The most common mis-feature is illustrated by:

(%i1) eq: a > b; (%o1) a > b (%i2) 2*eq; (%o2) 2 (a > b) (%i3) % - eq; (%o3) a > b

Another problem is 0 times an inequality; the default to have this
turn into 0 has been left alone. However, if you type
`X*`

and Maxima asks about the sign of `some_inequality``X`

and you
respond `zero`

(or `z`

), the program returns `X*`

and not use the information that `some_inequality``X`

is 0. You should do `ev (%, x: 0)`

in such
a case, as the database will only be used for comparison purposes
in decisions, and not for the purpose of evaluating `X`

.

The user may note a slower response when this package is loaded, as
the simplifier is forced to examine more rules than without the
package, so you might wish to remove the rules after making use of
them. Do `kill (rules)`

to eliminate all of the rules (including any
that you might have defined); or you may be more selective by
killing only some of them; or use `remrule`

on a specific rule.

Note that if you load this package after defining your own
rules you will clobber your rules that have the same name. The
rules in this package are:
`*rule1`

, ..., `*rule8`

,
`+rule1`

, ..., `+rule18`

,
and you must enclose the rulename in quotes to refer to it, as
in `remrule ("+", "+rule1")`

to specifically remove the first rule on `"+"`

or `disprule ("*rule2")`

to display the definition of the second multiplicative rule.

Categories: Simplification functions · Rules and patterns · Share packages · Package ineq

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

Categories: Expressions · Share packages · Package rducon

__Function:__**reduce_consts***(*`expr`)Replaces constant subexpressions of

`expr`with constructed constant atoms, saving the definition of all these constructed constants in the list of equations`const_eqns`

, and returning the modified`expr`. Those parts of`expr`are constant which return`true`

when operated on by the function`constantp`

. Hence, before invoking`reduce_consts`

, one should dodeclare ([

`objects to be given the constant property`], constant)$to set up a database of the constant quantities occurring in your expressions.

If you are planning to generate Fortran output after these symbolic calculations, one of the first code sections should be the calculation of all constants. To generate this code segment, do

map ('fortran, const_eqns)$

Variables besides

`const_eqns`

which affect`reduce_consts`

are:`const_prefix`

(default value:`xx`

) is the string of characters used to prefix all symbols generated by`reduce_consts`

to represent constant subexpressions.`const_counter`

(default value: 1) is the integer index used to generate unique symbols to represent each constant subexpression found by`reduce_consts`

.`load (rducon)`

loads this function.`demo (rducon)`

shows a demonstration of this function.Categories: Package rducon · Expressions

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

Categories: Expressions · Share packages · Package scifac

__Function:__**gcfac***(*`expr`)`gcfac`

is a factoring function that attempts to apply the same heuristics which scientists apply in trying to make expressions simpler.`gcfac`

is limited to monomial-type factoring. For a sum,`gcfac`

does the following:- Factors over the integers.
- Factors out the largest powers of terms occurring as coefficients, regardless of the complexity of the terms.
- Uses (1) and (2) in factoring adjacent pairs of terms.
- Repeatedly and recursively applies these techniques until the expression no longer changes.

Item (3) does not necessarily do an optimal job of pairwise factoring because of the combinatorially-difficult nature of finding which of all possible rearrangements of the pairs yields the most compact pair-factored result.

`load (scifac)`

loads this function.`demo (scifac)`

shows a demonstration of this function.Categories: Package scifac · Expressions

[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

__Function:__**sqrtdenest***(*`expr`)Denests

`sqrt`

of simple, numerical, binomial surds, where possible. E.g.(%i1) load (sqdnst)$ (%i2) sqrt(sqrt(3)/2+1)/sqrt(11*sqrt(2)-12); sqrt(3) sqrt(------- + 1) 2 (%o2) --------------------- sqrt(11 sqrt(2) - 12) (%i3) sqrtdenest(%); sqrt(3) 1 ------- + - 2 2 (%o3) ------------- 1/4 3/4 3 2 - 2

Sometimes it helps to apply

`sqrtdenest`

more than once, on such as`(19601-13860 sqrt(2))^(7/4)`

.`load (sqdnst)`

loads this function.Categories: Expressions · Share packages · Package sqdnst

[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |

This document was generated by *Jaime Villate* on *April, 11 2013* using *texi2html 1.76*.