Skip to content
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

Closed
wants to merge 13 commits into from

Commits on Feb 27, 2012

  1. 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
    flacjacket committed Feb 27, 2012
    Copy the full SHA
    779ef82 View commit details
    Browse the repository at this point in the history
  2. Additional Piecewise testing

    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()'.
    flacjacket committed Feb 27, 2012
    Copy the full SHA
    569cd41 View commit details
    Browse the repository at this point in the history
  3. 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.
    flacjacket committed Feb 27, 2012
    Copy the full SHA
    4ba539e View commit details
    Browse the repository at this point in the history
  4. 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.
    flacjacket committed Feb 27, 2012
    Copy the full SHA
    c86dea6 View commit details
    Browse the repository at this point in the history
  5. 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.
    flacjacket committed Feb 27, 2012
    Copy the full SHA
    7fe8654 View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    54367c0 View commit details
    Browse the repository at this point in the history
  7. 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.
    flacjacket committed Feb 27, 2012
    Copy the full SHA
    b1b27fa View commit details
    Browse the repository at this point in the history
  8. 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.
    flacjacket committed Feb 27, 2012
    Copy the full SHA
    15e54a0 View commit details
    Browse the repository at this point in the history
  9. 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.
    flacjacket committed Feb 27, 2012
    Copy the full SHA
    e8cbd8d View commit details
    Browse the repository at this point in the history

Commits on Mar 16, 2012

  1. Merging with master

    flacjacket committed Mar 16, 2012
    Copy the full SHA
    256094c View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2012

  1. Merge branch 'master' into piecewise_fixes

    Conflicts:
    	sympy/functions/elementary/piecewise.py
    	sympy/printing/tests/test_str.py
    flacjacket committed Mar 21, 2012
    Copy the full SHA
    b2bc48b View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2012

  1. Merge branch 'master' into piecewise_fixes

    Conflicts:
    	sympy/solvers/tests/test_ode.py
    flacjacket committed Mar 25, 2012
    Copy the full SHA
    e500e7d View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2012

  1. Merge branch 'master' into piecewise_fixes

    Conflicts:
    	sympy/printing/tests/test_str.py
    	sympy/stats/crv_types.py
    flacjacket committed Mar 31, 2012
    Copy the full SHA
    972d8fe View commit details
    Browse the repository at this point in the history