Opened 7 years ago

Closed 7 years ago

#13286 closed defect (fixed)

inconsistent behaviour of solve

Reported by: chapoton Owned by: burcin
Priority: minor Milestone: sage-5.3
Component: symbolics Keywords: solve, symbolic
Cc: Merged in: sage-5.3.beta2
Authors: Punarbasu Purkayastha Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

I have found the following :

sage: w,z=var('w','z')
sage: solve([z-4,w-3],[z,w])
[[z == 4, w == 3]]
sage: solve([z-4],z)                                       
[z == 4]
sage: solve([z-4,z-2],z)
[]
sage: solve([z-4,z-2],[z])
[]
sage: solve([z-4],[z])
TypeError: [z] is not a valid variable.

The last line is a really *bad* behaviour ! It forces to distinguish the case when there is only one equation and one variable. Compare also with the first solve.

Attachments (1)

trac_13286-allow_list_in_solve.patch (2.4 KB) - added by ppurka 7 years ago.
Apply to devel/sage

Download all attachments as: .zip

Change History (9)

comment:1 Changed 7 years ago by kcrisman

At first I thought this was part of #10750, but apparently not. Thanks for this report.

On the plus side, the behavior isn't that bad; it doesn't return a mathematically wrong result, gives a readable error message (this doesn't always happen in Sage!), and by reading solve? one can see the proper syntax. It isn't a good thing, but isn't horrendous.

comment:2 Changed 7 years ago by ppurka

  • Status changed from new to needs_review

Added a simple patch.

comment:3 Changed 7 years ago by ppurka

  • Authors set to Punarbasu Purkayastha

comment:4 follow-up: Changed 7 years ago by chapoton

Thanks for the ticket. Are you sure of the syntax of the links to trac ? According to #12490, it seems rather to be

:trac:`13077`

with no # inside.

Changed 7 years ago by ppurka

Apply to devel/sage

comment:5 in reply to: ↑ 4 Changed 7 years ago by ppurka

Replying to chapoton:

Thanks for the ticket. Are you sure of the syntax of the links to trac ?

Thanks for checking this. Indeed, it was incorrect. Have corrected the patch now.

comment:6 Changed 7 years ago by chapoton

  • Status changed from needs_review to positive_review

ok, positive review

comment:7 Changed 7 years ago by jdemeyer

  • Reviewers set to Frédéric Chapoton

comment:8 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.3.beta2
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.