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
I do not discount that it may be user-error, but I cannot get integrate to take my assumptions into account.
The following is a smaller version of what I am trying to do. It is an export of a Jupyter Notebook which is why I have a bunch of _ statements to show results.
SymPy 1.3, Python 3.6.8
fromsympyimport*fromsympy.assumptions.assumeimportglobal_assumptionsx0,x1,b0,b1=symbols('x0,x1,b0,b1')
# Add these to a list first since I will try to use them laterass= []
ass.append(Q.positive(b0))
ass.append(Q.finite(b0))
ass.append(Q.positive(b1))
ass.append(Q.finite(b1))
# First attempt:forass_inass:
global_assumptions.add(ass_)
F=exp(b0*x0+b1*x1) - (exp(b0) -1)*(exp(b1) -1)/(b0*b1)
print(integrate(F,(x0,0,1),(x1,0,1)))
withassuming(*ass):
_=integrate(F,(x0,0,1),(x1,0,1))
print(_)
withassuming(*ass):
_=simplify(integrate(F,(x0,0,1),(x1,0,1)))
print(_)
These all do not take into account the assumptions. Am I missing something? Or is SymPy missing it?
The text was updated successfully, but these errors were encountered:
Most of the code in SymPy follow old assumptions. There has been a plan to overthrow old assumptions and use new ones but currently the new assumptions are still being worked on and lack speed. Once the new system becomes viable, change in the codebase would be done to use new ones instead. Till then it is better to stick with old assumptions, they are fast and does their work.
Thanks for the update. The general documentation doesn't really talk about the "old" vs "new" way. I didn't even know about specifying the assumptions when I instantiate the symbols because it isn't (or at least not clearly) documented. They just talk about setting global assumptions.
I appreciate the help. I am going to leave this open since it still doesn't work with the new assumptions but I have no hard feelings if it is closed
I do not discount that it may be user-error, but I cannot get integrate to take my assumptions into account.
The following is a smaller version of what I am trying to do. It is an export of a Jupyter Notebook which is why I have a bunch of
_
statements to show results.SymPy 1.3, Python 3.6.8
These all do not take into account the assumptions. Am I missing something? Or is SymPy missing it?
The text was updated successfully, but these errors were encountered: