Solveset ignores assumptions for all the symbols. Actually it doesn't check assumptions.
On Thursday, 26 May 2016 01:14:12 UTC+5:30, chaowen guo wrote: > > Well, I want to make sure, does solveset just ignore the assumptions about > unknown, or ignore everything? > > For example: > > solveset(a+x**2,x); > > Of course, assumption about x is ignored. How about assumption about a? > > On Tuesday, May 24, 2016 at 5:55:43 PM UTC-5, Aaron Meurer wrote: >> >> 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/197c8168-036b-4688-8590-de84c779a0b8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
