Menu

#495 solve and ALL

open
nobody
5
2006-09-09
2004-01-25
No

Solve/algsys is inconsistent in how it represents the
solution "all values satisfy the equation":

solve([x=x],x) returns ALL
solve([y=y],x) returns ALL
solve([x=x],[x]) returns ALL
solve([x=x],[x,y]) returns [[x = %R10, y = %R9]]
solve([],[x]) returns []

First of all, the last case is simply wrong. The solution
to "find all x such that the empty set of constraints is
satisfied" is "all x", not "no x" (which is what [] means).
After all, the y=y case above includes an equation which
doesn't even mention x.

The other cases are inconsistent. We should use one or
the other. The %R10 approach (from algsys) seems
better, because it is completely consistent with the non-
all case. Any program using Solve will have to make a
special case for ALL otherwise.

I would also argue that SOLVE_INCONSISTENT_ERROR
should default to FALSE. That is, inconsistent systems
should return [], not give an error.

Discussion

  • Stavros Macrakis

    Logged In: YES
    user_id=588346

    A similar problem:

    solve( (x-1)^2 = (1-x)^2 , x)

    returns [x=x] and not ALL.

    This is actually worse than an inconsistency: since x appears
    on both sides of the solution, a calling program will assume
    that Solve failed to find a solution.

     
  • Robert Dodier

    Robert Dodier - 2006-07-22
    • labels: --> 460522
     
  • Robert Dodier

    Robert Dodier - 2006-09-09
    • labels: 460522 --> Lisp Core - Solving equations
     

Log in to post a comment.