# [Maxima] Manipulating inequalities WAS: Solving an equation with integral

Stavros Macrakis macrakis at alum.mit.edu
Fri Jul 20 17:15:22 CDT 2012

```On Fri, Jul 20, 2012 at 1:13 PM, Henry Baker <hbaker1 at pipeline.com> wrote:

> Thanks, Stavros; I'll give load(ineq) a try.
>
> Re extended inequalities: x<y<z
>
> Yes, the meaning is x<y and y<z, and I don't care how it is represented
> internally, but I would imagine that it would be easier to keep these in a
> form like:
>
> ["<",x,y,z]
>
> because you're going to need to do the same thing to all of the non-first
> elements, and you need to invert "<" to ">=" when multiplying by a negative
> number.
>

Easier for the case (a<b<c)*(-1), but multiple representations of the same
thing is almost always a bad idea.  We will always need to represent (a<b
AND a<c) and (a<b AND c<d) and (a<b AND b<c AND b<d).  Why should we
special-case (a<b AND b<c)?  How would we handle (a<q AND b<q AND q<x AND
q<y)? etc.

Not sure what your point about num/denom is.  You can easily enough define
a mapnumdenom function, something like

mapnumdenom(f,ex) := if atom(ex) or op(ex) <> "/" then ex else
f(part(ex,1))/f(part(ex,2))\$

-s

> Of course, x<y<=z is a bit trickier, so perhaps
>
> [x,"<",y,"<=",z] might be better.
>
> I wouldn't expect x<y>z to be supported, as it is too confusing & doesn't
> generalize very well.
>
> ---
>
> Also extended ratios, e.g.,
>
> x:y:z
>
> Extended ratios were a big deal in the 19th century & early 20th century,
> but they seem to have fallen out of the modern math curriculum.
>
> ---
>
> One thing I find myself constantly doing is the following:
>
> foo:factor(expression);
>
> foond:[num(%),denom(%)];
>
> ... some manipulations on foond[1] or foond[2] or both, followed by ...
>
> foo:foond[1]/foond[2];
>
> The problem is, I know better what needs to be done on the numerator
> or the denominator than Maxima/radcan/trigxxx/etc.
>
> Unfortunately, both the numerators & denominators of some of these
> expressions
> are ginormous, so if I let Maxima do its thing, I'd be waiting a week.
>
> Perhaps there is a better way to do this, but nothing comes to mind.
>
> At 06:49 AM 7/20/2012, Stavros Macrakis wrote:
> >(resending with better Subject line)
> >
> >Henry,
> >
> >load(ineq) does some of the inequality manipulations you ask for, like
> (-1)*(a<b) => -b < -a.
> >
> >As for expressions of the form a<b<=c, if I were to be designing such a
> feature (which I'm not), I'd treat that as a shorthand for (a<b) and
> (b<=c). That fits into Maxima's general philosophy of representing things
> in quasicanonical ways. But that presupposes that Maxima can do useful
> things with Boolean compositions of predicates (inequalities or otherwise),
> which it currently cannot, even in the simplest cases.  For example, a and
> not a and a<b and b<a currently don't simplify to false.  I think that
> capability is not only a prerequisite, but useful functionality in itself.
> >
> >           -s
> >
> >On Fri, Jul 20, 2012 at 9:21 AM, Henry Baker <hbaker1 at pipeline.com>
> wrote:
> >I've been using Maxima to "prove" a number of standard plane geometry
> >theorems, but using analytic geometry (real & complex algebra) instead
> >of Euclid.  It's actually surprisingly difficult to beat Maxima into
> >submission in order to do this.
> >
> >I wish I could summarize my experience into some succinct recommendations,
> >but so far I can't.
> >
> >There is one area that I recommended some improvement on a while back, but
> >so far no one has picked up the ball & run with it.
> >
> >I was doing some Khan Academy high school algebra exercises with Maxima,
> and
> >it would be useful to add high-school-type inequalities to Maxima.
> >
> >Briefly, in addition to having equality equations with a left-hand-side
> ("lhs")
> >and right-hand-side ("rhs"), it would be nice to allow
> >
> >declare([x,y,z],real);
> >
> >x < y+z;
> >
> >%-z;
> >
> >(outputs x-z < y)
> >
> >%*(-1);
> >
> >(outputs -x+z >= -y)
> >
> >There are also extended inequalities:
> >
> >x < y <= z, so it would be nice to have more than just lhs(), rhs(), etc.
> >
> >You get the idea.
> >
> >At 02:20 AM 7/20/2012, Rupert Swarbrick wrote:
> >>Raymond Toy <toy.raymond at gmail.com> writes:
> >>> I think having examples like this on the wiki would be very nice too.
>  I
> >>> always learn a lot from examples like this, and such examples are
> easier
> >>> for me to find on a wiki than on a mailing list with lots of other
> >>> discussions.
> >>>
> >>> Ray
> >>
> >>I suppose that the problem is how one might categorise them. Also, I'm
> >>pretty certain that there are exactly two things that allow me to come
> >>up with steps like this:
> >>
> >> (1) I've used Maxima for some time, so I am sort of fluent with the
> >>     different simplification functions and know what is likely to do
> >>     what.
> >>
> >> (2) I'm a maths PhD student and recently did an undergraduate maths
> >>     degree. Making sense of how to solve a problem like this does
> >>     require some knowledge of analysis. Being au fait with Taylor
> >>     expansions and when they do/do not work makes it easy to see what
> >>     "should happen".
> >>
> >>Maybe we could come up with some "ratsimp training" Wiki pages, which
> >>show how to use (say) expand, factor, gfactor, subst, ratsubst, ratsimp
> >>to wrangle expressions in a useful way. I can definitely see that this
> >>could make (1) easier to attain.
> >>
> >>For (2), well I realise that I've got much less training in numerical
> >>analysis and/or symbolic algebra than most of the people on this list
> >>that answer questions. Those who ask them tend to be maths, physics or
> >>engineering undergrads as far as I can tell. Some sort of "management of
> >>expectations" could maybe help people realise when they are expecting
> >>Maxima to do the impossible! (Or implausible, maybe).
> >>
> >>I should have some time this weekend and it would be fun to collect up a
> >>list as you suggest. I'll email Lyosha Beshenov for an account in a
> >>minute. Any suggestions on how to format the results?
> >>
> >>I was thinking something like:
> >>
> >>---------------
> >>How to [Do Something]
> >>=====================
> >>
> >>
> >>[Some background information along with a (possibly simplified)
> >> statement of the problem]
> >>
> >>[First thoughts: Is it reasonable to expect Maxima to solve this? How
> >> might I make it easier]
> >>
> >>[A solution]
> >>
> >>[Things that don't work and why]
> >>
> >>---------------
> >>
> >>But maybe others have better ideas?
> >>
> >>Rupert
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120720/c8f65b5a/attachment.html>
```