Re: [sympy] Re: A Taylor integrator compatible with SymPy

2021-09-30 Thread Francesco Biscani
Hi Chris, thanks for the kind words. I haven't tried the cse=True approach in SymPy, I'll check it out when 1.9 comes out. I would imagine that the outcome will be similar to the CSE in our expression system, but it will be interesting to know if there's something new we can learn. Kind regards,

Re: [sympy] RFC extended Interval

2021-09-30 Thread Aaron Meurer
I know this doesn't quite answer your question, but I think we should have two separate classes, RealInterval and ExtendedRealInterval. Interval could then act as a wrapper for the two. The issue is if an interval can include infinities, then you can't assume an interval with symbolic entries like

[sympy] RFC extended Interval

2021-09-30 Thread Chris Smith
I am exploring ways to implement an Interval that will contain infinite boundaries. I am under the assumption that we can't make `Interval(-oo, oo)` mean `[-oo, oo]`. Currently the default is to *automatically* exclude them, so `Interval(1, oo)` means `[1, oo)`. My idea is to use another key

Re: [sympy] Re: A Taylor integrator compatible with SymPy

2021-09-30 Thread Aaron Meurer
On Thu, Sep 30, 2021 at 11:59 AM Chris Smith wrote: > > I had a brief look at the tides and spokes. My impression was that it was > well presented. > > I am curious on the large expressions for which you used subexpression > elimination and wonder if you have tried `lambdify(..., cse=True)` on t

Re: [sympy] emulate a lambda

2021-09-30 Thread Aaron Meurer
It is relevant to think about how we might do this in other ways, though, because if we ever want to make Functions themselves Basic objects we would need to refactor them in a similar way (https://github.com/sympy/sympy/issues/4787). In fact, if Functions were objects, we could just store the func

Re: [sympy] emulate a lambda

2021-09-30 Thread Aaron Meurer
My understanding is that an OracleGate is just the quantum version of Function. It probably should just be Function (maybe a subclass that mixes Function and Gate), with users creating oracles by subclassing and defining eval. Aaron Meurer On Thu, Sep 30, 2021 at 4:12 PM Chris Smith wrote: > > h

Re: [sympy] emulate a lambda

2021-09-30 Thread Chris Smith
https://qiskit.org/textbook/ch-gates/oracles.html On Thursday, September 30, 2021 at 3:13:15 PM UTC-5 Oscar wrote: > I don't know what the OracleGate class is for but I'm pretty sure it's not > very useful and it's certainly poorly designed. I'd rather just delete it > than try to come up with

Re: [sympy] emulate a lambda

2021-09-30 Thread Oscar Benjamin
I don't know what the OracleGate class is for but I'm pretty sure it's not very useful and it's certainly poorly designed. I'd rather just delete it than try to come up with hacks to make it work. If someone wants to maintain the quantum module then that's great. Until then we shouldn't allow brok

Re: [sympy] emulate a lambda

2021-09-30 Thread Aaron Meurer
Although storing f in the .args of an expression would be just as problematic as storing a lambda, because functions are not objects. So you might need to make a custom evaluator class similar to Lambda that stores a given lambda on it. It's a little messy because it breaks with the SymPy pattern t

Re: [sympy] emulate a lambda

2021-09-30 Thread Aaron Meurer
So it sounds like OracleGate needs the function to not be symbolic at all. You can use the following to create a symbolic function that evaluates as a given lambda: >>> f = Function('f', eval=lambda x: x == 1) >>> f(1) True >>> f(0) False Aaron Meurer On Wed, Sep 29, 2021 at 8:19 PM Chris Smith

[sympy] Re: A Taylor integrator compatible with SymPy

2021-09-30 Thread Chris Smith
I had a brief look at the tides and spokes. My impression was that it was well presented. I am curious on the large expressions for which you used subexpression elimination and wonder if you have tried `lambdify(..., cse=True)` on them with any favorable results. I look forward to spending som