I think we can store a Lambda in the args, similar to ImageSet. Alternatively if the lambda always only has 1 argument we could store OracleGate(1, x, Eq(x, 2)). (I'm having a little hard time understanding exactly what should be allowed for the second arg of OracleGate).
Aaron Meurer On Tue, Sep 28, 2021 at 12:38 PM Oscar Benjamin <[email protected]> wrote: > > On Tue, 28 Sept 2021 at 10:22, Aaron Meurer <[email protected]> wrote: >> >> Why not just Lambda(x, Eq(x, 1))? >> >> I don't think redefining __eq__ to return a symbolic result is a good >> idea. You're liable to get a lot of "TypeError: cannot determine truth >> value of Relational" errors from using that object. > > > There is a missing context for the question in this thread: > https://github.com/sympy/sympy/pull/22152#discussion_r716898734 > > The OracleGate class has a non-Basic lambda function in its args: > > In [3]: from sympy.physics.quantum.grover import OracleGate > > In [4]: e = OracleGate(1, lambda x: x == 2) > > In [5]: e.args > Out[5]: (1, <function __main__.<lambda>(x)>) > > The question was how you could sympify such a lambda function to Basic: > https://github.com/sympy/sympy/pull/22152#issuecomment-928631629 > > -- > Oscar > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CAHVvXxQ_SJA2S8Oc6Rmiu9Z3CBs5WnhnnePsvp-HcN11_0x1Jg%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6J%3DM1c8aRKdY4OO_kQJZqKkFTVONwMVK%2BdiiKqvc4o6Zw%40mail.gmail.com.
