On Fri, 18 Jun 2021 at 11:07, Paul Royik <distantjob...@gmail.com> wrote:

> I want to parse logic implication `p->q`. What should I add to
> global_dict, so that parse_expr parsed it?
>
> I know, that SymPy doesn't have and Implication class. I will create it by
> myself, but `global_dict = {'->': Implication}` doesn't work.
>

I don't think there is any way to add operators to `parse_expr`. SymPy does
have Implies though:


In [*1*]: Implies

Out[*1*]: Implies


In [*2*]: Implies(x, y)

Out[*2*]: x → y

The operator used for this is left/right shift:

In [*3*]: x >> y

Out[*3*]: x → y


In [*4*]: x << y

Out[*4*]: y → x

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 sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxRvhVQBWXvRkjJRWk4b9sp5SSjAH5D7DqOOUR1GbTKHVg%40mail.gmail.com.

Reply via email to