You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Symbol class allows one to specify assumptions. Assumptions are frequently needed in engineering and physics to express that certain variables are real and positive (e.g. mass of a particle). Which assumptions are understood by Sympy is not well documented and mistyping the assumptions does not cause an error, which is bad.
Documentation issues
Docstring of function symbols
The docstring mentions assumptions and shows integer and real in examples, but does not list all possible assumptions nor does it point to the place where such a list can be found (the latter would be better, the assumptions should be documented in the Symbol class, I suppose).
Docstring of class Symbol
The docstring mentions assumptions in the class docstring but does not list all possible assumptions. The docstring of assumptions0 (why the 0 at the end?) also does not list all possible assumptions, they only appear by chance in the example code.
Searching for "assumption" in Sympy docs yields results, but not on first hit
When you search in the Sympy online docs for the string "assumption" you find these hits (in that order):
The class Symbol does not validate the assumptions. One can pass arbitrary arguments. The user is not informed about typos, this is bad.
>>>fromsympyimportSymbol>>>Symbol("x", real=True).assumptions0# OK, real is a valid assumption
{'real': True, 'complex': True, 'imaginary': False, 'hermitian': True, 'infinite': False, 'finite': True, 'commutative': True, 'extended_real': True}
>>>Symbol("x", is_real=True).assumptions0# BAD, is_real is not a valid assumption, this should raise an error
{'is_real': True, 'commutative': True}
The text was updated successfully, but these errors were encountered:
I did write a lengthy page for the docs about assumptions here: #20090
I think it needs to be reorganised though.
HDembinski
changed the title
Possible assumptions poorly documented and missing validation of assumptions
Allowed assumptions poorly documented and missing validation of assumptions
May 2, 2021
@oscarbenjamin Glad to see your contribution, I quickly read over the new docs and this is very much what I feel is missing in the user guide. Complementary to that I think the docstrings need to be improved as well to point the user to the right info.
The
Symbol
class allows one to specify assumptions. Assumptions are frequently needed in engineering and physics to express that certain variables are real and positive (e.g. mass of a particle). Which assumptions are understood by Sympy is not well documented and mistyping the assumptions does not cause an error, which is bad.Documentation issues
symbols
The docstring mentions assumptions and shows
integer
andreal
in examples, but does not list all possible assumptions nor does it point to the place where such a list can be found (the latter would be better, the assumptions should be documented in the Symbol class, I suppose).Symbol
The docstring mentions assumptions in the class docstring but does not list all possible assumptions. The docstring of
assumptions0
(why the0
at the end?) also does not list all possible assumptions, they only appear by chance in the example code.When you search in the Sympy online docs for the string "assumption" you find these hits (in that order):
The first hit is very confusing and not what one was searching for.
The second hit is finally listing all possible assumptions. This is what the user wants to see.
This is again a variation of the first hit and therefore not useful.
Validation issues
The class
Symbol
does not validate the assumptions. One can pass arbitrary arguments. The user is not informed about typos, this is bad.The text was updated successfully, but these errors were encountered: