[sympy] Re: Maxima's ratsubst

2009-09-07 Thread Aaron S. Meurer
On Sep 7, 2009, at 7:03 PM, Ondrej Certik wrote: > > > > On Sep 7, 5:20 pm, Andreas Klöckner > wrote: >> Hi there, >> >> I'm happy to see that Sympy has come a long way since the last time I >> looked, and I'd love to ditch Maxima in its favor. In trying to do >> so, >> I was looking for a re

[sympy] Re: Maxima's ratsubst

2009-09-07 Thread Aaron S. Meurer
If I understand what this function does correctly, it is like algsubs in Maple. We don't have it yet, but I agree that we are in dire need of it. See issue 1520 [0]. It shouldn't be too hard to implement. You would just need to add a flag to subs that would cause something like (cos(x)*

[sympy] Re: Maxima's ratsubst

2009-09-07 Thread Ondrej Certik
On Sep 7, 5:20 pm, Andreas Klöckner wrote: > Hi there, > > I'm happy to see that Sympy has come a long way since the last time I > looked, and I'd love to ditch Maxima in its favor. In trying to do so, > I was looking for a replacement for Maxima's tremendously useful > "ratsubst" function [1],

[sympy] Maxima's ratsubst

2009-09-07 Thread Andreas Klöckner
Hi there, I'm happy to see that Sympy has come a long way since the last time I looked, and I'd love to ditch Maxima in its favor. In trying to do so, I was looking for a replacement for Maxima's tremendously useful "ratsubst" function [1], but I couldn't find any sign of something like it in the

[sympy] Re: bug in core/mul/_eval_subs

2009-09-07 Thread Aaron S. Meurer
You can use your example below as a test. Also, you could try putting a print statement on line 733 to see what tests use it and modify them to use negative exponents (by the way, looking at the code, it looks like someone just miscopied it. Line 735 should match line 733, but it instead

[sympy] Re: bug in core/mul/_eval_subs

2009-09-07 Thread Ondrej Certik
On Mon, Sep 7, 2009 at 10:37 AM, Ryan Krauss wrote: > I would be glad to, but I think I need to understand the code better to > write a valid test.  Should that line get executed any time there is 1/term > in the experssion? In any case, let's write your test case as a test and then fix that lin

[sympy] Re: bug in core/mul/_eval_subs

2009-09-07 Thread Ryan Krauss
I would be glad to, but I think I need to understand the code better to write a valid test. Should that line get executed any time there is 1/term in the experssion? On Mon, Sep 7, 2009 at 12:32 PM, Aaron S. Meurer wrote: > > If you run the coverage script in bin/, you will find that that line

[sympy] Re: bug in core/mul/_eval_subs

2009-09-07 Thread Aaron S. Meurer
If you run the coverage script in bin/, you will find that that line is not covered by the test suite, so it is quite possible that it is wrong. Indeed, if I make the change you specify, the tests still all pass. Could you create a patch that fixes it and includes a test? Aaron Meurer On

[sympy] Re: bug in core/mul/_eval_subs

2009-09-07 Thread Ryan Krauss
Along these same lines, should this substitution work: In [12]: temp30 Out[12]: -EI*c4*beta**3/L**3 In [13]: temp30.subs(L**2/EI, a) Out[13]: -EI*c4*beta**3/L**3 I have to invert both inputs to subs to get the result I was hoping for: In [14]: temp30.subs(EI/(L**2), 1/a) Out[14]: -c4*beta**3/(

[sympy] bug in core/mul/_eval_subs

2009-09-07 Thread Ryan Krauss
I think I have stumbled onto a bug in core/mul/_eval_subs. I have the following expression: In [103]: temp Out[103]: c3*L**2/(EI*beta**2) and am trying to substitute a = L**2/EI: In [104]: temp.subs(L**2/EI, a) which produces the following traceback: /home/ryan/git/sympy/sympy/core/mul.pyc in