On Sat, Apr 4, 2009 at 9:37 AM, Freddie Witherden <fred...@witherden.org> wrote: > Hi all, > > I am wondering if it is possible to change the real=True|False property of > the symbols used by sympify/S created when parsing an expression. > > E.g., S('sqrt(x^2)'), how can I then specify that x is real? While I can > access the Symbol's using .atoms(Symbol) I can not work out how to modify > their properties. > > What is the best way of going about this?
You can give your symbols to sympify, e.g.: In [2]: sympify("sqrt(x**2)", {"x": Symbol("x", positive=True)}) Out[2]: x In [3]: sympify("sqrt(x**2)", {"x": Symbol("x", negative=True)}) Out[3]: -x But after our new assumption system, this will not be needed anymore. Ondrej --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---