Skip to content

Commit

Permalink
Merge pull request sympy#12141 from Yathartha22/doc_solve
Browse files Browse the repository at this point in the history
Fixing sympy#7615 : Documented required things
  • Loading branch information
asmeurer authored Feb 10, 2017
2 parents 3a574bd + 443cb61 commit 3652aa7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion sympy/solvers/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,18 +452,26 @@ def solve(f, *symbols, **flags):
>>> solve(x < 3)
And(-oo < x, x < 3)
* to always get a list of solution mappings, use flag dict=True
>>> solve(x - 3, dict=True)
[{x: 3}]
>>> solve([x - 3, y - 1], dict=True)
>>> sol = solve([x - 3, y - 1], dict=True)
>>> sol
[{x: 3, y: 1}]
>>> sol[0][x]
3
>>> sol[0][y]
1
* to get a list of symbols and set of solution(s) use flag set=True
>>> solve([x**2 - 3, y - 1], set=True)
([x, y], {(-sqrt(3), 1), (sqrt(3), 1)})
* single expression and single symbol that is in the expression
>>> solve(x - y, x)
Expand Down
2 changes: 2 additions & 0 deletions sympy/solvers/solveset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,6 +1293,8 @@ def linsolve(system, *symbols):
return solution




##############################################################################
# ------------------------------nonlinsolve ---------------------------------#
##############################################################################
Expand Down

0 comments on commit 3652aa7

Please sign in to comment.