Opened 3 years ago

Last modified 10 months ago

#24102 new defect

solve(....solution_dict=True) produces nonsense

Reported by: rws Owned by:
Priority: major Milestone: sage-8.1
Component: symbolics Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


sage: solve([x**2-1>0,x>0],x,solution_dict=True)
[{1: x}]

Probably the correct result from Maxima is mistranslated. Of course inequalities expressing interval results should not be converted to dict.

Change History (1)

comment:1 Changed 10 months ago by charpent

Another mistranslation, found when fooling around #21789 :

sage: SG=desolve(eq, y(x)) ; SG
(_K2*log(x) + _K1)*x
sage: #  Boundary conditions
sage: solve([SG(x=1)==e, SG(x=e)==2*e],[_K1,_K2])
[[e == _K1, _K2 == -e + 2]]
sage: solve([SG(x=1)==e, SG(x=e)==2*e],[_K1,_K2], solution_dict=True)
[{e: _K1, _K2: -e + 2}]

Such "solutions" inverting (part of) variable-value couples, can't be used for further substitution. This may be a cause of #21789...

Note that :

sage: var("a, b")
(a, b)
sage: solve([SG(x=1)==a, SG(x=e)==b],[_K1,_K2], solution_dict=True)
[{_K1: a, _K2: -(a*e - b)*e^(-1)}]
sage: SG.subs(solve([SG(x=1)==a, SG(x=e)==b],[_K1,_K2], solution_dict=True))(x=1)
sage: SG.subs(solve([SG(x=1)==a, SG(x=e)==b],[_K1,_K2], solution_dict=True))(x=e)
....: .expand()

This hints at a mishandling of "variable-lookalike" constants. Deep in the Maxima interface...

Note: See TracTickets for help on using tickets.