Hi, so I gave it a more thorough look, here is how to play with it:
git clone git://github.com/certik/sympy.git cd sympy git checkout -b wick2 origin/wick2 In general I think it looks good and I only have couple minor comments below, after fixing them, let's commit it, so that it's in and we can improve upon it later. I am very excited about this, thanks again! Minor comments: 1) the tests fail: $ ./setup.py test [...] sympy/utilities/tests/test_code_quality.py:test_no_trailing_whitespace_and_no_tabs File "/home/ondrej/repos/sympy/sympy/utilities/tests/test_code_quality.py", line 71, in test_no_trailing_whitespace_and_no_tabs check_directory_tree(sympy_path) File "/home/ondrej/repos/sympy/sympy/utilities/tests/test_code_quality.py", line 56, in check_directory_tree assert False, message_gen_raise % (fname, idx+1) AssertionError: File contains generic exception: /home/ondrej/repos/sympy/sympy/physics/secondquant.py, line 2121 ________________________________________________________________________________ _______ sympy/utilities/tests/test_code_quality.py:test_implicit_imports _______ File "/home/ondrej/repos/sympy/sympy/utilities/tests/test_code_quality.py", line 113, in test_implicit_imports check_directory_tree_imports(examples_path, exclude) File "/home/ondrej/repos/sympy/sympy/utilities/tests/test_code_quality.py", line 88, in check_directory_tree_imports assert False, message_implicit % (fname, idx+1) AssertionError: File contains an implicit import: /home/ondrej/repos/sympy/examples/intermediate/coupled_cluster.py, line 1. tests finished: 1656 passed, 2 failed, 9 skipped, 38 xfailed in 175.24 seconds DO *NOT* COMMIT! just fix those couple things that we test in the code quality tests. 2) the first patch contains tabs instead of spaces, let's use 4 tabs only. If you use vim, you can use this setup (then you just hit TAB or backspace and it will shift the cursor 4 spaces to the right or left): syn on set exrc set autowrite set tabstop=4 set shiftwidth=4 set textwidth=79 set softtabstop=4 set bs=indent,eol,start set expandtab set autoindent set suffixesadd=.py filetype indent on map <F2> :w<CR> map <F10> :!/usr/bin/env python "%"<CR> map <F8> :TlistToggle<CR><C-w>h let Tlist_Inc_Winwidth=0 set fileencodings=ucs-bom,utf-8,default,latin2 (you may not need everything from above) Also in: - def doit(self): - return Derivative(self.expr, *self.symbols,**{'evaluate': True}) + def doit(self, **hints): + hints['evaluate'] = True + return Derivative(self.expr, *self.symbols,**hints) let's put one space after ",", e.g.: + return Derivative(self.expr, *self.symbols, **hints) (I know the original code also didn't have it). 3) the coupled_cluster cluster example doesn't run: $ python examples/intermediate/coupled_cluster.py Calculates the Coupled-Cluster energy- and amplitude equations See 'An Introduction to Coupled Cluster Theory' by T. Daniel Crawford and Henry F. Schaefer III Setting up hamiltonian Traceback (most recent call last): File "examples/intermediate/coupled_cluster.py", line 32, in <module> f = AntiSymmetricTensor('f',(p,),(q,)) NameError: name 'AntiSymmetricTensor' is not defined 4) please use explicit imports in the example. Then it would be clear that the import: from sympy.physics.secondquant import * doesn't import AntiSymmetricTensor. 5) let's add doctests (they are for users to understand how to call the methods, not for testing the code itself). I know the original file also doesn't have them: ond...@crow:~/repos/sympy(master)$ bin/coverage_doctest.py sympy/physics/secondquant.py ---------------------------------------------------------------------- sympy/physics/secondquant.py Missing documentation: * canonize(cls, arg) * eval(cls, arg) * canonize(cls, i, j) * eval(cls, i, j) * state(self) * is_symbolic(self) * apply_operator(self, state) * apply_operator(self, state) * apply_operator(self, state) * up(self, i) * down(self, i) * split_commutative_parts(m) * canonize(cls, bra, ket) * eval(cls, bra, ket) * bra(self) * ket(self) * index(self, state) * state(self, i) * index(self, state) * state(self, i) Missing doctests: * apply_Mul(m) * apply_operators(e) * matrix_rep(op, basis) * move(e, i, d) * commutator(a, b) SCORE sympy/physics/secondquant.py: 0% (0 of 25) ---------------------------------------------------------------------- However, after your patches it's still bad: $ bin/coverage_doctest.py sympy/physics/secondquant.py ---------------------------------------------------------------------- sympy/physics/secondquant.py Missing documentation: * canonize(cls, arg) * eval(cls, arg) * wrap_tuples(*args, **kw_args) * symbol(self) * upper(self) * lower(self) * doit(self, **kw_args) * eval(cls, i, j) * indices_contain_equal_information(self) * preffered_index(self) * killable_index(self) * state(self) * is_symbolic(self) * apply_operator(self, state) * apply_operator(self, state) * apply_operator(self, state) * apply_operator(self, state) * apply_operator(self, state) * up(self, i) * down(self, i) * split_commutative_parts(m) * canonize(cls, bra, ket) * eval(cls, bra, ket) * bra(self) * ket(self) * index(self, state) * state(self, i) * index(self, state) * state(self, i) * doit(self,**hints) * doit(self, **kw_args) * iter_q_annihilators(self) * iter_q_creators(self) Missing doctests: * eval(cls,symbol, upper, lower) * is_above_fermi(self) * is_below_fermi(self) * is_only_above_fermi(self) * is_only_below_fermi(self) * doit(self,**kw_args) * is_restricted(self) * is_above_fermi(self) * is_below_fermi(self) * is_only_below_fermi(self) * is_only_above_fermi(self) * is_q_creator(self) * is_q_annihilator(self) * is_only_q_creator(self) * is_only_q_annihilator(self) * is_q_creator(self) * is_q_annihilator(self) * is_only_q_creator(self) * is_only_q_annihilator(self) * up(self, i) * down(self, i) * only_below_fermi(cls,i) * only_above_fermi(cls,i) * apply_Mul(m) * apply_operators(e) * matrix_rep(op, basis) * move(e, i, d) * eval(cls, a,b) * eval(cls,arg) * has_q_creators(self) * has_q_annihilators(self) * get_subNO(self, i) * contraction(a,b) * evaluate_deltas(e) * substitute_dummies(expr, newIndices=False, reverse_order=True, prettyIndices=True) * Wicks(e, **kw_args) * get_permuted(self,expr) * simplifyIndexPermutations(expr, permutation_operators) SCORE sympy/physics/secondquant.py: 0% (0 of 71) ---------------------------------------------------------------------- If you are short on time, I can fix the easy stuff, but it'd help if you could write some doctests, at least for your own new code (since you understand it the best). I will then try to write doctests for the rest. We have a policy, that all new code should be 100% doctested. This will be then automatically included in the sphinx documentation, thus it will be super easy for the users to see how to use it. Also, please use explicit imports in the doctests. Tomorrow I am going to UC Davis for 2 days, so I might be off the internet till Wednesday. Ondrej --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patches@googlegroups.com To unsubscribe from this group, send email to sympy-patches+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy-patches?hl=en -~----------~----~----~----~------~----~------~--~---