#16753: solve of equation system misses trivial simplifications
-------------------------------------+-------------------------------------
Reporter: rws | Owner:
Type: defect | Status: needs_work
Priority: critical | Milestone: sage-6.4
Component: calculus | Resolution:
Keywords: | Merged in:
Authors: Akshay Ajagekar | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/ajagekar.akshay/Trac16753 | 88dec5a75c53522f0a24889b4e60efda0964d700
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by nbruin):
* status: needs_review => needs_work
Comment:
This solution doesn't fly. Presently:
{{{
sage: solve([x==5],[x])
[x == 5]
}}}
with this patch, it would return []. That's bad.
In general, I think it's bad to silently returning an empty list in a case
where we know we failed to "solve" the system. An empty list can be
interpreted as an inconsistent system of equations.
The original behaviour, returning the original system, indicates better a
failure to solve than an empty solution list does. Therefore, I think that
is preferable.
You could argue that returning the original system would be "invalid"
output, because usually it means that the LH sides of the equations aren't
the to-be-solved-for variables and/or the RH sides won't be free of them.
In that case, returning an error is a better solution.
I think the parsing that happens for `solution_dict=True` is definitely
broken:
{{{
sage: solve([y == sin(x), y + 4*sin(x) == 5],[x,y],solution_dict=True)
[{y: sin(x)}, {y + 4*sin(x): 5}]
}}}
Compared with
{{{
sage: solve([x^2==5,y==6],[x,y],solution_dict=True)
[{y: 6, x: -sqrt(5)}, {y: 6, x: sqrt(5)}]
}}}
it's clearly very misleading output. So for `solution_dict=True` I think
we have a good case for an error. Without it, I think the current output
is misleading. But so is:
{{{
sage: solve(x-1,x)
[x == 1]
sage: solve([x-1],[x])
[x == 1]
sage: solve([x-1,y-1],[x,y])
[[x == 1, y == 1]]
sage: solve([x-1],[x],solution_dict=True)
TypeError: 'sage.symbolic.expression.Expression' object is not iterable
}}}
(we'd probably be better off if also in the single-variable case we'd also
return list-of-lists etc.)
Beware of legacy, though. There might be users out there that have grown
fond of this bad behaviour and somehow depend on it.
--
Ticket URL: <http://trac.sagemath.org/ticket/16753#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.