Re: [sympy] Triggering special behavior of SymPy functions

2011-06-06 Thread Aaron Meurer
On Mon, Jun 6, 2011 at 9:20 PM, Ronan Lamy wrote: > Le lundi 06 juin 2011 à 19:32 -0700, Matthew Rocklin a écrit : >> So in each elementary SymPy function, call it foo, under the eval >> method I could add a test to see if the argument has an attribute, >> _eval_foo and if so call it? > > That doe

Re: [sympy] Triggering special behavior of SymPy functions

2011-06-06 Thread Ronan Lamy
Le lundi 06 juin 2011 à 19:32 -0700, Matthew Rocklin a écrit : > So in each elementary SymPy function, call it foo, under the eval > method I could add a test to see if the argument has an attribute, > _eval_foo and if so call it? That doesn't sound like a good idea, there are just too many funct

Re: [sympy] Triggering special behavior of SymPy functions

2011-06-06 Thread Aaron Meurer
Yep. Except you should just add the behavior to Function, so that it does it for all subclasses. Aaron Meurer On Mon, Jun 6, 2011 at 8:32 PM, Matthew Rocklin wrote: > So in each elementary SymPy function, call it foo, under the eval method I > could add a test to see if the argument has an attr

Re: [sympy] Triggering special behavior of SymPy functions

2011-06-06 Thread Matthew Rocklin
So in each elementary SymPy function, call it foo, under the eval method I could add a test to see if the argument has an attribute, _eval_foo and if so call it? On Mon, Jun 6, 2011 at 7:09 PM, Aaron Meurer wrote: > On Mon, Jun 6, 2011 at 7:19 PM, Matthew Rocklin > wrote: > >> > In an ideal wor

Re: [sympy] Triggering special behavior of SymPy functions

2011-06-06 Thread Aaron Meurer
On Mon, Jun 6, 2011 at 7:19 PM, Matthew Rocklin wrote: >> > In an ideal world the operand (in this case the random variable X) would >> > be >> > able to take control. This is the case for some functions like abs which >> > just call the object’s __abs__ method. I can’t find any evidence that >> >

Re: [sympy] Triggering special behavior of SymPy functions

2011-06-06 Thread Matthew Rocklin
> > > In an ideal world the operand (in this case the random variable X) would > be > > able to take control. This is the case for some functions like abs which > > just call the object’s __abs__ method. I can’t find any evidence that > this > > is possible generally in the Python language although

Re: [sympy] Triggering special behavior of SymPy functions

2011-06-06 Thread Aaron Meurer
Hi. On Mon, Jun 6, 2011 at 6:30 PM, Matthew Rocklin wrote: > Hi everyone, > > I'm working on implementing random variables in SymPy. The goal is to have > them syntactically behave like normal variables but carry around more > complex information like symbolic probability density functions (PDFs)

[sympy] Triggering special behavior of SymPy functions

2011-06-06 Thread Matthew Rocklin
Hi everyone, I'm working on implementing random variables in SymPy. The goal is to have them syntactically behave like normal variables but carry around more complex information like symbolic probability density functions (PDFs). I would like to be able to define X, a random variable and then defi

[sympy] Re: Question about representing full expressions in sympy.physics.quantum

2011-06-06 Thread Julien Rioux
On Jun 6, 6:12 pm, Tomo Lazovich wrote: > Hi everyone, > Hi, > I've been working on representations of operators and kets in the position > and momentum bases. So far, from what I can tell, the desired behavior is to > return something like DiracDelta(x_1-x_2) for a representation of |x_1> > (pos

Re: [sympy] Solving f(x) congruent to 0 mod (n)

2011-06-06 Thread Aaron Meurer
Yes, make a pull request (though I can already see problems with your code, like whitespace errors and that you need to wrap the text in your docstrings). Aaron Meurer On Mon, Jun 6, 2011 at 3:06 PM, Hector wrote: > > > On Tue, Jun 7, 2011 at 1:04 AM, Aaron S. Meurer wrote: >> >> On Jun 6, 2011

[sympy] Question about representing full expressions in sympy.physics.quantum

2011-06-06 Thread Tomo Lazovich
Hi everyone, I've been working on representations of operators and kets in the position and momentum bases. So far, from what I can tell, the desired behavior is to return something like DiracDelta(x_1-x_2) for a representation of |x_1> (position ket), and something like x_1*DiracDelta(x_1-x_2) fo

Re: [sympy] Solving f(x) congruent to 0 mod (n)

2011-06-06 Thread Hector
On Tue, Jun 7, 2011 at 1:04 AM, Aaron S. Meurer wrote: > On Jun 6, 2011, at 10:44 AM, Hector wrote: > > > > On Tue, Mar 29, 2011 at 5:42 AM, Mateusz Paprocki wrote: > >> Hi, >> >> On 28 March 2011 16:40, Aaron S. Meurer wrote: >> >>> If this is implemented anywhere, it would be on the polys modu

Re: [sympy] Solving f(x) congruent to 0 mod (n)

2011-06-06 Thread Aaron S. Meurer
On Jun 6, 2011, at 10:44 AM, Hector wrote: > > > On Tue, Mar 29, 2011 at 5:42 AM, Mateusz Paprocki wrote: > Hi, > > On 28 March 2011 16:40, Aaron S. Meurer wrote: > If this is implemented anywhere, it would be on the polys module. So I would > check there. I don't remember off the top of m

Re: [sympy] Solving f(x) congruent to 0 mod (n)

2011-06-06 Thread Hector
On Tue, Mar 29, 2011 at 5:42 AM, Mateusz Paprocki wrote: > Hi, > > On 28 March 2011 16:40, Aaron S. Meurer wrote: > >> If this is implemented anywhere, it would be on the polys module. So I >> would check there. I don't remember off the top of my head right now if it >> has been implemented or