Nächste: Package rducon, Vorige: Package functs, Nach oben: simplification [Inhalt][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*some_inequality
and Maxima asks about the sign of X
and
you respond zero
(or z
), the program returns
X*some_inequality
and not use the information that 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.
Nächste: Package rducon, Vorige: Package functs, Nach oben: simplification [Inhalt][Index]