Re: [sympy] Re: Getting `nan` or `oo` after subs when not simplified

2014-07-18 Thread Richard Fateman
On Wednesday, July 16, 2014 8:35:49 PM UTC-7, James Crist wrote: On Friday, July 11, 2014 11:13:28 PM UTC-5, Richard Fateman wrote: The obvious brute force method would be to use software floats in which case you could increase the precision and the range of the numbers involved. I'm

Re: [sympy] Re: Pattern matching

2014-07-18 Thread Aaron Meurer
On Fri, Jul 18, 2014 at 6:38 AM, F. B. franz.bona...@gmail.com wrote: On Friday, July 18, 2014 5:05:37 AM UTC+2, Ondřej Čertík wrote: This is also the sort of thing that would benefit from a performant core. We would write patterns in SymPy and then match them using some C++ matching

[sympy] Replace method not respecting non-commutativity

2014-07-18 Thread Keaton Burns
Hello, I'm using the replace method to substitute a function symbol with a python lambda function, but this process is failing to respect non-commutativity. This can be seen with a simple example: import sympy as sy x, y = sy.symbols('x, y', commutative=False) f = sy.Function('f')

Re: [sympy] Re: Pattern matching

2014-07-18 Thread Richard Fateman
On Thursday, July 17, 2014 7:07:19 PM UTC-7, Matthew wrote: The benefit of pattern matching is that 1 complex if-then-else constructions are hard to write well. Writing 10,000 rules and being sure that you have 100% coverage of all possible case and no overlap is a challenge. It's

Re: [sympy] Re: Getting `nan` or `oo` after subs when not simplified

2014-07-18 Thread Aaron Meurer
On Fri, Jul 18, 2014 at 10:26 AM, Richard Fateman fate...@gmail.com wrote: On Wednesday, July 16, 2014 8:35:49 PM UTC-7, James Crist wrote: On Friday, July 11, 2014 11:13:28 PM UTC-5, Richard Fateman wrote: The obvious brute force method would be to use software floats in which case you

Re: [sympy] Replace method not respecting non-commutativity

2014-07-18 Thread Aaron Meurer
It looks like it's because when simultaneous=True (the default), it uses Dummy symbols, which do not keep the assumptions of the symbols they replace. If you set simultaneous=False, it works correctly. Aaron Meurer On Fri, Jul 18, 2014 at 1:52 PM, Keaton Burns keaton.bu...@gmail.com wrote:

Re: [sympy] Replace method not respecting non-commutativity

2014-07-18 Thread Keaton Burns
Thanks, that's working great. Is there a reason not to just pass the commutative assumptions to the dummy variables, with d = Dummy(commutative=expr.is_commutative)? This seems to work for my cases. On Friday, July 18, 2014 9:18:46 PM UTC-4, Aaron Meurer wrote: It looks like it's because

Re: [sympy] Replace method not respecting non-commutativity

2014-07-18 Thread Aaron Meurer
Yes, it should do it. It was just an oversight I'm sure. Maybe Symbol should have an as_dummy method for such situations that produces a Dummy variable with the same assumptions. Aaron Meurer On Fri, Jul 18, 2014 at 8:54 PM, Keaton Burns keaton.bu...@gmail.com wrote: Thanks, that's working

Re: [sympy] Replace method not respecting non-commutativity

2014-07-18 Thread Aaron Meurer
And of course, after I type that, I check, and I see that that exact thing is already implemented. So it should be using that. Aaron Meurer On Fri, Jul 18, 2014 at 10:56 PM, Aaron Meurer asmeu...@gmail.com wrote: Yes, it should do it. It was just an oversight I'm sure. Maybe Symbol should have