Pref::keepOrder -- order of
terms in sum outputs
IntroductionPref::keepOrder influences the output order of terms in
sums.
Call(s)Pref::keepOrder(Always)
Pref::keepOrder(DomainsOnly)
Pref::keepOrder(System)
Pref::keepOrder(NIL)
Pref::keepOrder()
OptionsAlways |
- | the output always corresponds to the internal order |
DomainsOnly |
- | only polynomials and domain elements are printed in their internal order |
System |
- | the output system always decides the output order |
Returnsthe previously defined value: Always, DomainsOnly, or System.
Related
FunctionsDOM_POLY, Dom::MultivariatePolynomial,
Dom::Polynomial,
Dom::UnivariatePolynomial,
print
Detailssum to optimize the
appearance of the output. This order may be different from the internal
ordering of the sum. The output system prefers to re-order the terms
such that the first term is positive.Pref::keepOrder(Always).Pref::keepOrder(NIL) restores the default
state, which is DomainsOnly.Pref::keepOrder() returns the currently
set value.
Option: Always
Option: DomainsOnlyPref::keepOrder.
Option: System
Example
1Here we create a domain element e, an
expression f, and a polynomial p containing
sums. With the default setting DomainsOnly, only
the output of the expression f is not in the internal
order:
>> d := newDomain("d"): d::print := x -> extop(x):
e := new(d, b - a): f := b - a: p := poly(1 - x):
e, f, p
- a + b, b - a, poly(- x + 1, [x])
With the setting Always,
e, f, and p are all printed in
the internal order:
>> Pref::keepOrder(Always): e, f, p
- a + b, - a + b, poly(- x + 1, [x])
With the setting System, the
output order differs from the internal ordering for e,
f, and p:
>> Pref::keepOrder(System): e, f, p
b - a, b - a, poly(1 - x, [x])
Pref::keepOrder(NIL) restores
the default state; Pref::keepOrder() returns
the current setting:
>> Pref::keepOrder(NIL): Pref::keepOrder()
DomainsOnly
Pref::keepOrder is now taken into account in both
PRETTYPRINT
modes.