solveset ignores assumptions. Instead, you should pass the domain that you wish to solve over as the domain parameter, like solveset(eq, x, domain=S.Reals).
Relational assumptions like E+1 require the new assumptions (ask(), Q, refine()). This is still a work in progress and may not work very well in every case. Most functions in SymPy only consider the old assumptions (positive=True, is_positive). Aaron Meurer On Tue, May 24, 2016 at 5:05 PM, chaowen guo <[email protected]> wrote: > Hi: > > the example > > import sympy > energy=sympy.symbols('E',positive=True) > from sympy.assumptions.assume import global_assumptions > global_assumptions.add(sympy.Q.positive(energy-1)) > position=sympy.symbols('r',real=True) > momentum=energy-1-sympy.exp(position) > interval=sympy.solveset(momentum,position,sympy.S.Reals) > print(interval) > > the output is:Intersection((-oo, oo), {log(E - 1)}) > > And then I ask: > sympy.ask(sympy.Q.positive(energy-1)) > the output is true > > So it seems that solveset totally ignores the global_assumptions. How to > tell solveset the global_assumptions, so it can use them to do more > simplification? > > I also try sympy.refine and sympy.simplify to simplify the final interval, > but none of them can simplify interval to just {log(E-1)}; > > By the way, I want to ask how does the assumption system interact with other > part of sympy. I know I can give assumption when I define variables, like > real=True, > positive=True. But I can not give relative assumption, like E+1 is positive > or A-B is greater than C. I figure out global_assumptions may consider > relative > assumption. But how about the other parts of sympy, like solveset, > integrate, integrate.transform, simplify? Do they take global_assumptions > into consideration? > I know mathematica, maple and maxima all support relative assumption. And > they can use the assumptions to do more simplification. Does the assumption > system in > sympy act like the same way? > > -- > 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 https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/8ca64f15-1a83-4a66-87db-fa0f9ebea279%40googlegroups.com. > 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 https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BEUU60HTNGW3z0TUFSEwVrPYdneKTR2GPfG7UwjBeMxA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
