Re: Issue 1337 in sympy: find all instances in an expression

2011-05-03 Thread sympy
Updates: Status: Fixed Labels: -NeedsReview PassedReview Comment #36 on issue 1337 by matt...@gmail.com: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 This is now in master. -- You received this message because you are subscribed to

Re: Issue 1337 in sympy: find all instances in an expression

2011-03-05 Thread sympy
Comment #35 on issue 1337 by smi...@gmail.com: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 I updated the docstring and code a bit in c2 of my p12 branch. -- You received this message because you are subscribed to the Google Groups "sympy-patches"

Re: Issue 1337 in sympy: find all instances in an expression

2011-02-02 Thread sympy
Comment #34 on issue 1337 by asmeurer: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 You should be able to do that. Just use two Wilds. Those rules and patterns should be implemented in Wild, so that everything that uses Wild (match, replace, etc.)

Re: Issue 1337 in sympy: find all instances in an expression

2011-02-01 Thread sympy
Comment #33 on issue 1337 by elliso...@gmail.com: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 This is very exciting as we need this in a huge way in the quantum stuff. Just a question, we often need to do replacements like this: Obj1(a)*Obj2(b

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-08 Thread sympy
Comment #31 on issue 1337 by asmeurer: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 It looks good. I would include an example of what map=True does in the docstring. Looking forward to replacing some of my risch_integrate() code with this. -- You

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-08 Thread sympy
Comment #30 on issue 1337 by mattpap: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 I went ahead and implemented preliminary version of replace(), e.g.: In [1]: f = log(sin(x)) + tan(sin(x**2)) In [2]: a = Wild('a') In [3]: f.replace(sin(a), cos(a))

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-07 Thread sympy
Comment #29 on issue 1337 by asmeurer: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 Yeah, I think he stopped working on it. His work is at https://github.com/bastikr/sympy in the subs and match branches. Someone should pick up where he left off.

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-07 Thread sympy
Comment #28 on issue 1337 by Vinzent.Steinberg: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 I like it. This way, subs() would be very basic and fast, whereas replace() can do the advanced stuff. replace() reminds me of rewrite(). Sebastian crea

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-07 Thread sympy
Comment #27 on issue 1337 by mattpap: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 Function should have an explicit meaning. If we realize that a function does the job of two or more, we should split it. Adding options managers is the option of las

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-07 Thread sympy
Comment #26 on issue 1337 by asmeurer: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 Well, if subs is going to have an options manager as planned, then you could just make the replace feature an option to subs. But like I said, I also like having i

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-07 Thread sympy
Comment #25 on issue 1337 by mattpap: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 subs() and replace() have different semantics. Both get two arguments, but 1. subs() gets a Basic instance, tries to find all its occurrences in an expression and rep

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-06 Thread sympy
Comment #24 on issue 1337 by asmeurer: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 Or you could just add it to subs. I like replace, though. -- You received this message because you are subscribed to the Google Groups "sympy-patches" group. To post

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-06 Thread sympy
Comment #23 on issue 1337 by mattpap: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 We can add replace() method with the following syntax: expr.replace(query_or_type_or_pattern, make_it_a_little_different_function) (or it can be find_and_replace()).

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-06 Thread sympy
Comment #22 on issue 1337 by Vinzent.Steinberg: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 By the way, this can be very useful for an expression rewriting function This was actually the motivation for opening this issue. :) -- You received thi

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-06 Thread sympy
Comment #21 on issue 1337 by asmeurer: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 atoms seems to be a little slower (though not by much): In [10]: %timeit f.atoms(tan) 1 loops, best of 3: 90.5 us per loop In [11]: %timeit f.find(tan) 1 loop

Re: Issue 1337 in sympy: find all instances in an expression

2011-01-04 Thread sympy
Comment #20 on issue 1337 by smichr: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 While normal atoms can do some of what find does, f.atoms(tan) set([tan(1), tan(x**2), tan(tan(1 - x)), tan(1 - x)]) It can't find more general patterns so this looks

Re: Issue 1337 in sympy: find all instances in an expression

2010-12-31 Thread sympy
Updates: Labels: NeedsReview Comment #19 on issue 1337 by mattpap: find all instances in an expression http://code.google.com/p/sympy/issues/detail?id=1337 As a side effect of my work on improving polynomial systems solver I introduced a similar find() method in Basic (commit 2c965f0