-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TODO: rebase Addressing Piecewise issues #1009
Commits on Feb 27, 2012
-
New Piecewise syntax and fix Piecewise issues
Piecewise syntax is changed to allow for a more sensible definition of the otherwise condition. Before, an expr/cond pair was specified where cond was given as True. Now, otherwise can either be passed as the final argument after a sequence of expr/cond 2-tuples. The old otherwise syntax using (otherwise, True) raises a deprecation warning. The ExprCondPair class is removed in favor of Tuples to store the expr/cond pairs. The '.as_leading_term()' function is changed so that it takes the sum of all the expressions and, if it is not NaN, the otherwise statement, and returns the leading term of the sum. Ideally, '.as_leading_term()' would return a Piecewise function, but doing this breaks the evaluation of 'abs(x-a).nseries(x, 1)'. Piecewise no longer accepts an Interval as a condition. To implement the same functionality, either the '.as_relational()' or '.contains()' methods of Interval can be used. Piecewise also no longer accepts numbers as conditions. The properties '.exprcondpairs' and '.otherwise' are implemented to easily access the expr/cond pairs and otherwise statement, respectively. Addresses issues: 2101, 2567, 2626, 2710, 2726
Configuration menu - View commit details
-
Copy full SHA for 779ef82 - Browse repository at this point
Copy the full SHA 779ef82View commit details -
Changes allowing evaluate keyword to override default behavior of clearing nested Piecewise expressions. More testing of new Piecewise evaluate keyword behavior, including an XFAIL test related to Issue 3025, where evaluate=False does not override behavior when bools are in the conditions. Includes new tests and doctests for '.exprcondpairs' and '.otherwise' properties. Re-enables testing for expressions in expr/cond pairs and the otherwise statement to be Expr or GeometryEntity. GeometryEntity is needed due to the use of Piecewise in the geometry module for '.arbitrary_point()'.
Configuration menu - View commit details
-
Copy full SHA for 569cd41 - Browse repository at this point
Copy the full SHA 569cd41View commit details -
Change Piecewise evaluation behavior
Piecewise evaluation now returns the first expression which is explicitly True. If no conditions are True, the otherwise expression is returned. Evaluation can be triggered by setting the 'evaluate' keyword to True. When a boolean is given as a condition, evaluation is enabled unless specifically disabled by setting 'evaluate' to False. In this case, any explicitly False conditions are removed and any explicitly True conditions are given as the otherwise statement. This is done so bools are kept out of args, see Issue 3025. The collapsing of nested Piecewise functions is moved from eval to the __new__ method. This is performed by default, but setting 'evaluate' to False will disable it.
Configuration menu - View commit details
-
Copy full SHA for 4ba539e - Browse repository at this point
Copy the full SHA 4ba539eView commit details -
Add Piecewise .doit() to perform evaluation
Added a .doit() method to Piecewise functions. This allows for forced evaluation of the Piecewise function. If you want to call doit() to evaluate args but not evaluate the Piecewise function itself, evaluate=False can be added to the hints.
Configuration menu - View commit details
-
Copy full SHA for c86dea6 - Browse repository at this point
Copy the full SHA c86dea6View commit details -
Fix other code to work with new Piecewise evaluation
Change '.doit()' keyword for evaluating Piecewise objects from 'evaluate' to 'piecewise' and set other functions to use this to avoid evaluation of Piecewise when required. Having no expr/cond pairs is treated like having bools in the conditions.
Configuration menu - View commit details
-
Copy full SHA for 7fe8654 - Browse repository at this point
Copy the full SHA 7fe8654View commit details -
Configuration menu - View commit details
-
Copy full SHA for 54367c0 - Browse repository at this point
Copy the full SHA 54367c0View commit details -
Fix up documentation of Piecewise objects
Improve documentation of Piecewise objects, specifying how the new evaluation functionality works, how it is overridden and the limitations posed by not being able to have bools in the args.
Configuration menu - View commit details
-
Copy full SHA for b1b27fa - Browse repository at this point
Copy the full SHA b1b27faView commit details -
Piecewise raises error with bool args and evaluate=False
Change behavior of Piecewise so if bools are given as args and it is given the keyword evaluate=False, it raises a NotImplementedError. This can be changed once classes implementing boolean logic that subclass Basic are implemented. Changes are made in meijerint to parse the args of a Piecewise function used in that module which may have bool conditions, but should not be evaluated. This can be changed to use evaluate=False when the Basic boolean classes are implemented.
Configuration menu - View commit details
-
Copy full SHA for 15e54a0 - Browse repository at this point
Copy the full SHA 15e54a0View commit details -
Fix type checking in Piecewise
Change checking in Piecewise to take expr/cond pairs only in tuples, Tuples or lists, all other expressions go to otherwise. Drop the type checking for the exprs and otherwise statement.
Configuration menu - View commit details
-
Copy full SHA for e8cbd8d - Browse repository at this point
Copy the full SHA e8cbd8dView commit details
Commits on Mar 16, 2012
-
Configuration menu - View commit details
-
Copy full SHA for 256094c - Browse repository at this point
Copy the full SHA 256094cView commit details
Commits on Mar 21, 2012
-
Merge branch 'master' into piecewise_fixes
Conflicts: sympy/functions/elementary/piecewise.py sympy/printing/tests/test_str.py
Configuration menu - View commit details
-
Copy full SHA for b2bc48b - Browse repository at this point
Copy the full SHA b2bc48bView commit details
Commits on Mar 25, 2012
-
Merge branch 'master' into piecewise_fixes
Conflicts: sympy/solvers/tests/test_ode.py
Configuration menu - View commit details
-
Copy full SHA for e500e7d - Browse repository at this point
Copy the full SHA e500e7dView commit details
Commits on Mar 31, 2012
-
Merge branch 'master' into piecewise_fixes
Conflicts: sympy/printing/tests/test_str.py sympy/stats/crv_types.py
Configuration menu - View commit details
-
Copy full SHA for 972d8fe - Browse repository at this point
Copy the full SHA 972d8feView commit details