Skip to content

fix some bugs / typos in the solve function #4786

@williamstein

Description

@williamstein
Is this the right place for suggestions for the function "solve" ?

1) The docstring has a typo : "... solve an equation of system ..."
Should be an "or" here.

2) The section
" solution_dict = True -- return a list of dictionaries containing the
solutions. "
made me think that solution_dict defaults to True which is not the case.
Maybe this could be made more clear.

3) 'solution_dict = True' fails when only a single univariate equation
is given. The solution is then not a list of lists and the conversion to
dictionary fails:

sage: var('a')
a
sage: solve ([a^2-1],a,solution_dict=True)
-
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/tom/<ipython console> in <module>()

/usr/local/sage/local/lib/python2.5/site-packages/sage/calculus/equations.pyc
in solve(f, *args, **kwds)
  1436         sol_list = string_to_list_of_solutions(a)
  1437         if 'solution_dict' in kwds and kwds['solution_dict']==True:
- -> 1438             sol_dict=[dict([[eq.left(),eq.right()] for eq in
solution]) for solution in sol_list]
  1439             return sol_dict
  1440         else:

AttributeError: 'SymbolicVariable' object has no attribute 'left'


Thanks for your great work.
Thomas

Component: calculus

Author: Karl-Dieter Crisman, Burcin Erocal

Reviewer: Burcin Erocal, Karl-Dieter Crisman

Merged: Sage 4.1.2.alpha2

Issue created by migration from https://trac.sagemath.org/ticket/4786

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions