Newbie Question -- Expression Evaluation



Bill, thanks for your interest in Maxima.

> First, it appears there are no facilities specifically for solving
> inequalities, linear or otherwise, right?

Not for solving inequalities, but there is an add-on package named ineq
which allows some manipulation of 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.
(%o1) /usr/share/maxima/5.9.3.99rc4/share/simplification/ineq.mac
(%i2) ieq1 : x + 4 < 2 * (x + 5);
(%o2)                   x + 4 < 2 (x + 5)
(%i3) ieq1 - 4;
(%o3)                   x < 2 (x + 5) - 4
(%i4) expand (%);
(%o4)                      x < 2 x + 6
(%i5) % - x;
(%o5)                       0 < x + 6
(%i6) % - 6;
(%o6)                        - 6 < x

> Second, I have the expression "x + 4 < 2 * (x + 5)" bound to the label
> "ieq1".  I can't get it evaluated even after "assume( equal(x, 2) )".  I
> also tried evaluating "at( ieq1, [x=0] )" which returned "4 < 10", which
> seemed like progress, but following that with "ev( % )" returned the
> same thing.  How do I get expressions like this evaluated?  More
> fundamentally, what am I missing?

Well, here are two ways to get ieq1 evaluated for a specific value of x.
(1) Assign a value to x and reevaluate ieq1.
(2) Evaluate ieq1 with a value temporarily assigned to x.

Method (1) changes x, (2) doesn't. Example:

Method (2). At the input prompt, "foo, x = bar" is equivalent to
"ev(foo, x = bar)".

(%i7) ev (ieq1, x = 0);
(%o7)                        4 < 10
(%i8) ieq1, x = 0;
(%o8)                        4 < 10

Method (1). ieq1 is not automatically reevaluated after assigning to x;
the quote-quote operator (two single quotes, not a double quote)
causes ieq1 to be reevaluated.

(%i9) x : 0;
(%o9)                           0
(%i10) ieq1;
(%o10)                  x + 4 < 2 (x + 5)
(%i11) ''ieq1;
(%o11)                       4 < 10

Hope this helps

Robert Dodier