Looks good. Brian
On Sat, Feb 20, 2010 at 3:11 PM, Øyvind Jensen <jensen.oyv...@gmail.com>wrote: > --- > sympy/physics/secondquant.py | 29 ++++++++++++++++++++--------- > 1 files changed, 20 insertions(+), 9 deletions(-) > > diff --git a/sympy/physics/secondquant.py b/sympy/physics/secondquant.py > index 93f9ca3..858c222 100644 > --- a/sympy/physics/secondquant.py > +++ b/sympy/physics/secondquant.py > @@ -2505,27 +2505,38 @@ def _substitute(expr, ordered_dummies, > arg_iterator, **require): > Dummies without the keyword in .assumptions0 will be default to > give the value False. > > + Warning > + ======= > + > + Apart from checking the keyword requirements, nothing is done to > prevent > + loss of information during substitution. > + > + > + Examples > + ======== > + > >>> from sympy import Symbol > - >>> from sympy.physics.secondquant import substitute_dummies, > _substitute > + >>> from sympy.physics.secondquant import substitute_dummies, > _substitute,F > >>> q = Symbol('q', dummy=True) > >>> i = Symbol('i', below_fermi=True, dummy=True) > >>> a = Symbol('a', above_fermi=True, dummy=True) > - > >>> reverse = lambda x: reversed(x) > - >>> _substitute(a, [q], reverse, above_fermi=True) # will succeed > - _a > - >>> _substitute(i, [q], reverse, above_fermi=True) # will not > succeed > - _i > - >>> _substitute(i, [q], reverse, above_fermi=False) # will succeed > - _i > + > + >>> _substitute(F(a), [q], reverse, above_fermi=True) # will succeed > + AnnihilateFermion(_q) > + >>> _substitute(F(i), [q], reverse, above_fermi=True) # will not > succeed > + AnnihilateFermion(_i) > + >>> _substitute(F(i), [q], reverse, above_fermi=False) # will succeed > + AnnihilateFermion(_q) > > With no keywords, all dummies are substituted. > > + >>> _substitute(F(i), [q], reverse) # will succeed > + AnnihilateFermion(_q) > """ > > dummies = _remove_duplicates(_get_dummies(expr, arg_iterator, > **require)) > subslist = _get_subslist(dummies, ordered_dummies) > - > result = expr.subs(subslist) > return result > > -- > 1.6.5 > > -- > You received this message because you are subscribed to the Google Groups > "sympy-patches" group. > To post to this group, send email to sympy-patc...@googlegroups.com. > To unsubscribe from this group, send email to > sympy-patches+unsubscr...@googlegroups.com<sympy-patches%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/sympy-patches?hl=en. > > -- You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post to this group, send email to sympy-patc...@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.