The docstring of sympify() explains this issue in more detail and how to work around it. http://docs.sympy.org/latest/modules/core.html#sympy.core.sympify.sympify
Aaron Meurer On Tue, Jul 21, 2015 at 10:33 PM, Jason Moore <[email protected]> wrote: > "N" is a function in SymPy, so is "S". So sympify is trying to transform > those into a function. You can avoid the variables that clash with top > level sympy functions as work around. > > > Jason > moorepants.info > +01 530-601-9791 > > On Tue, Jul 21, 2015 at 8:22 PM, Hong Xu <[email protected]> wrote: > >> Hi, >> >> When I tried to run >> >> >> print(sympify('a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N')) >> >> I got the error: >> >> >> Traceback (most recent call last): >> File "test.py", line 6, in <module> >> >> print(sympify('a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N')) >> File >> "/home/user/.local/lib/python3.4/site-packages/sympy/core/sympify.py", line >> 317, in sympify >> expr = parse_expr(a, local_dict=locals, >> transformations=transformations, evaluate=evaluate) >> File >> "/home/user/.local/lib/python3.4/site-packages/sympy/parsing/sympy_parser.py", >> line 820, in parse_expr >> return eval_expr(code, local_dict, global_dict) >> File >> "/home/user/.local/lib/python3.4/site-packages/sympy/parsing/sympy_parser.py", >> line 733, in eval_expr >> code, global_dict, local_dict) # take local objects in preference >> File "<string>", line 1, in <module> >> File >> "/home/user/.local/lib/python3.4/site-packages/sympy/logic/boolalg.py", >> line 34, in __or__ >> return Or(self, other) >> File >> "/home/user/.local/lib/python3.4/site-packages/sympy/core/operations.py", >> line 404, in __new__ >> _args = frozenset(cls._new_args_filter(args)) >> File >> "/home/user/.local/lib/python3.4/site-packages/sympy/logic/boolalg.py", >> line 374, in _new_args_filter >> for x in args: >> File >> "/home/user/.local/lib/python3.4/site-packages/sympy/core/operations.py", >> line 402, in <genexpr> >> args = (_sympify(arg) for arg in args) >> File >> "/home/user/.local/lib/python3.4/site-packages/sympy/core/sympify.py", line >> 350, in _sympify >> return sympify(a, strict=True) >> File >> "/home/user/.local/lib/python3.4/site-packages/sympy/core/sympify.py", line >> 272, in sympify >> raise SympifyError(a) >> sympy.core.sympify.SympifyError: SympifyError: <function N at >> 0x7f3e5c913620> >> >> Is there a hard coded number of variables sympify can handle, or a >> different reason? >> >> Thanks! >> >> Hong >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/sympy. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/239d6ad7-f46a-422e-b3f6-f32ca85a5f81%40googlegroups.com >> <https://groups.google.com/d/msgid/sympy/239d6ad7-f46a-422e-b3f6-f32ca85a5f81%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CAP7f1Aj1CeNwPVh-eEXfq6DbOjwTD-9hbz%2BcWiK%3DAb5ER00DJw%40mail.gmail.com > <https://groups.google.com/d/msgid/sympy/CAP7f1Aj1CeNwPVh-eEXfq6DbOjwTD-9hbz%2BcWiK%3DAb5ER00DJw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6KoLTVv9pSu%2B5gWJyvtbprzRQNoS_ZOYL5v7OAM44hTZA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
