Re: [sympy] SymPy thrown into infinite loop

2012-11-30 Thread Shriramana Sharma
On Sat, Dec 1, 2012 at 10:15 AM, Aaron Meurer wrote: > The bug here is that the binomial(n, 5) is automatically evaluating > itself. It should remain unevaluated, except when expand(func=True) > is called on it. Reported http://code.google.com/p/sympy/issues/detail?id=3544 -- Shriramana Sharma

Re: [sympy] RFC: should Rational accept floats?

2012-11-30 Thread Ronan Lamy
Le 30/11/2012 22:23, Aaron Meurer a écrit : It's worth pointing out that Float does the same thing, if you give it a high enough precision. Try Float(3.2, 100) for example. To me, it should just work. Yes, we should encourage the use of strings over float literals, but Rational(float) not workin

Re: [sympy] SymPy thrown into infinite loop

2012-11-30 Thread Aaron Meurer
On Fri, Nov 30, 2012 at 9:27 PM, Shriramana Sharma wrote: > On Sat, Dec 1, 2012 at 9:32 AM, Aaron Meurer wrote: >> I guess it's not necessarily a good idea to auto-expand things like >> binomial(n, 5). Go ahead and open another issue for that if you want. >> Probably it should be changed to rema

Re: [sympy] SymPy thrown into infinite loop

2012-11-30 Thread Shriramana Sharma
On Sat, Dec 1, 2012 at 9:32 AM, Aaron Meurer wrote: > I guess it's not necessarily a good idea to auto-expand things like > binomial(n, 5). Go ahead and open another issue for that if you want. > Probably it should be changed to remain unevaluated, and to expand > with expand(func=True). Hi Aaro

Re: [sympy] SymPy thrown into infinite loop

2012-11-30 Thread Aaron Meurer
If you call simplify, it simplifies a little bit. I guess it's not necessarily a good idea to auto-expand things like binomial(n, 5). Go ahead and open another issue for that if you want. Probably it should be changed to remain unevaluated, and to expand with expand(func=True). Aaron Meurer On

Re: [sympy] SymPy thrown into infinite loop

2012-11-30 Thread Shriramana Sharma
On Sat, Dec 1, 2012 at 9:13 AM, Shriramana Sharma wrote: >> easy way to fix it is to use summation(t**i*Ra(i),(i,0,5)).doit(). > > Wow nice, that works! ... but the problem is that it expands the binomial function too and the output is not so readable as a result: t**5*(-n*(n - 4)*(n - 3)*(n - 2

Re: [sympy] SymPy thrown into infinite loop

2012-11-30 Thread Shriramana Sharma
Thanks for replying. On Sat, Dec 1, 2012 at 8:49 AM, Aaron Meurer wrote: > > easy way to fix it is to use summation(t**i*Ra(i),(i,0,5)).doit(). Wow nice, that works! > Care to open an issue for this in our issue tracker > (https://code.google.com/p/sympy/issues/list)? I reported it here with y

Re: [sympy] SymPy thrown into infinite loop

2012-11-30 Thread Aaron Meurer
On Fri, Nov 30, 2012 at 8:00 PM, Shriramana Sharma wrote: > Hello. Trying to execute the following minimal example throws SymPy > into an infinite loop. (Obviously this is an extract from my actual > program.) I tried debugging using eric5 but beyond that the problem > occurs within the Ra() funct

[sympy] SymPy thrown into infinite loop

2012-11-30 Thread Shriramana Sharma
Hello. Trying to execute the following minimal example throws SymPy into an infinite loop. (Obviously this is an extract from my actual program.) I tried debugging using eric5 but beyond that the problem occurs within the Ra() function, I couldn't find out anything. Can please anyone tell me what I

Re: [sympy] RFC: should Rational accept floats?

2012-11-30 Thread Aaron Meurer
It's worth pointing out that Float does the same thing, if you give it a high enough precision. Try Float(3.2, 100) for example. To me, it should just work. Yes, we should encourage the use of strings over float literals, but Rational(float) not working makes it seem as if the conversion is not su

[sympy] RFC: should Rational accept floats?

2012-11-30 Thread smichr
At http://code.google.com/p/sympy/issues/detail?can=2&q=2950 I give the reasons why I don't think it should. The work is at https://github.com/sympy/sympy/pull/1680 (which disallows it). Should we just let the user shoot themselves in the foot if they request Rational from floats or should we

Re: [sympy] RFH: request for help

2012-11-30 Thread Matthew Rocklin
That link didn't work for me. This one did though http://code.google.com/p/sympy/issues/detail?id=3250 No other help to offer at the moment. On Fri, Nov 30, 2012 at 2:12 PM, smichr wrote: > On issue 3250 I have a function that will allow precision to be preserved > during conversion into and o

Re: [sympy] How to define a symbolic function

2012-11-30 Thread Aaron Meurer
A python function will just return whatever you tell it to return. If you give it symbolic input, it will plug that in and return it. A subclass of Function will work like In [20]: class MyFunc(Function): : @classmethod : def eval(cls, arg): : if arg == 1:

[sympy] RFH: request for help

2012-11-30 Thread smichr
On issue 3250 I have a function that will allow precision to be preserved during conversion into and out of Poly but it is giving an error that I am familiar with, but not in the current context: "foo() takes exactly 1 argument (2 given)" I can't see what I am doing wrong. I describe the proble

Re: [sympy] How to define a symbolic function

2012-11-30 Thread Aaron Meurer
Oh, for that, you want to subclass Function and define the eval method. implemented_function might do this as well (I don't remember the details and I'm not at my computer right now). Aaron Meurer On Nov 30, 2012, at 8:04 AM, Shriramana Sharma wrote: > On Fri, Nov 30, 2012 at 10:06 AM, Aaron Me

Re: [sympy] How to define a symbolic function

2012-11-30 Thread Shriramana Sharma
On Fri, Nov 30, 2012 at 10:06 AM, Aaron Meurer wrote: > lambdify and implemented_function are best if you intend to evaluate > these numerically. Otherwise, just use a regular Python function. Hi thanks. Please also clarify how I can make a function which accepts a symbolic argument but does not