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

1858b (1811) separatevars modifications and noncommutative factoring #422

Merged
merged 12 commits into from Mar 13, 2012

Conversation

smichr
Copy link
Member

@smichr smichr commented Jun 15, 2011

Changes basically following those described at http://code.google.com/p/sympy/issues/detail?id=1811 are contained in these commits. In addition, iterable functions common_prefix and common_suffix are added to handle identification of extractable sequences in noncommutative terms and are used in a noncommutative factoring routine.

I've left these as a series of individual commits hoping that this might help in the review process (to keep the individual changes per commit small).

After committing, search issues for this pull request number (e.g. put "422" in the search box to see which might have been related to this issue.)

@smichr smichr closed this Oct 20, 2011
@smichr smichr reopened this Oct 20, 2011
@smichr smichr closed this Dec 7, 2011
@smichr smichr reopened this Feb 29, 2012
@jrioux
Copy link
Member

jrioux commented Feb 29, 2012

I would have expected that I can just use factor() and it would call factor_nc() when necessary.

@smichr
Copy link
Member Author

smichr commented Feb 29, 2012

Yes...but first I need to get factor_nc in place. One change at a time,
seems to work better.

expr = expr.subs(rep)
return expr, dict([(v, k) for k, v in rep]) or None, nc_syms

def factor_nc(expr, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this go to sympy/core/expr.py ? That's where factor() is defined.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this go to sympy/core/expr.py ? That's where factor() is defined.

I can move it there.

@asmeurer
Copy link
Member

asmeurer commented Mar 2, 2012

Perhaps http://arxiv.org/abs/1002.3180 could be useful here. I didn't read it too deeply, but it doesn't seem complicated. Feel free to open an issue for it if you don't want to work on it now.

@asmeurer
Copy link
Member

asmeurer commented Mar 2, 2012

That paper also shows that non-commutative factorization is not unique in the multivariate case. They give the example:

In [23]: x, y = symbols('x y', commutative=False)

In [24]: expand((y*x + 1)*(y*x*y - y))
Out[24]: -y + yxyxy

In [25]: expand((y*x - 1)*(y*x*y + y))
Out[25]: -y + yxyxy

@smichr
Copy link
Member Author

smichr commented Mar 3, 2012

I'll open an issue. Thanks for the ref, it does look useful.

@smichr
Copy link
Member Author

smichr commented Mar 3, 2012

OK, this is ready to go from my end.

@smichr
Copy link
Member Author

smichr commented Mar 3, 2012

All 2.7 tests have passed.

@smichr
Copy link
Member Author

smichr commented Mar 7, 2012

The factorial simplification test was moved to the factorial test suite.

@asmeurer
Copy link
Member

asmeurer commented Mar 8, 2012

@jrioux do you plan to finish reviewing this?

@jrioux
Copy link
Member

jrioux commented Mar 8, 2012

Sure -- The work looks good to me, and last time I checked the tests pass on my machine (python 2.7.0). Not sure what "finish reviewing this" involves though. Are there contributor guidelines posted somewhere? I wouldn't mind helping to get this pushed.

@asmeurer
Copy link
Member

asmeurer commented Mar 8, 2012

Nothing particularly surprising. Just go through the code and make sure it looks OK. Make sure that everything is well tested (especially any new features or bug fixes). New public functions should have docstrings with doctests (I don't think that's the case here). Finally, make sure the tests pass. SymPy-Bot is a good way to do that.

The point to reviewing is to get a second set of eyes on the code. There's no checklist of things to look for for each one (if the process could be completely automated, it would be). What you've done so far is basically all there is to it. If you're worried about missing something, just check the added tests, because that's our #1 force against regression.

@jrioux
Copy link
Member

jrioux commented Mar 9, 2012

tests fail, NameError:
sympy/functions/combinatorial/tests/test_comb_factorials.py is missing from sympy.utilities.pytest import XFAIL

@smichr
Copy link
Member Author

smichr commented Mar 10, 2012

XFAIL is imported; this was rebased on master. All 32-bit, py 2.7 tests pass.

@jrioux
Copy link
Member

jrioux commented Mar 12, 2012

The two "fix tests" commits should probably be squashed with other commits in order not to gratuitously break git bisect, but otherwise this looks good to me.

    no tests fail without this; the full expansion is only
    done with the factor step
    factoring of noncommutatives fails so this should be avoided
    If the expression is univariate, there is nothing to separate
    (though factoring might change things, this is not the purpose
    of this routine).
    Just as the routine need not start when the whole expression is
    univariate, it also does not need to end with factoring if the
    nonseparated terms are univariate.
    These functions can be used when looking for common
    noncommutative sequences.
@smichr
Copy link
Member Author

smichr commented Mar 13, 2012

I did squash some together. An option to know about when bisecting is git bisect --skip which will skip over a troublesome commit and give you a range of commits where the failure may occur.

Thanks for finishing up this review. This is now in.

smichr added a commit that referenced this pull request Mar 13, 2012
1858b (1811) separatevars modifications and noncommutative factoring
@smichr smichr merged commit 8d4122a into sympy:master Mar 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants