Thank you!

That's exactly what I was looking for.

On Monday, November 4, 2024 at 1:53:54 PM UTC+2 Oscar wrote:

> SymPy can represent various sets and you can use Contains e.g.:
>
> In [44]: Contains(x, Reals)
> Out[44]: x ∈ ℝ
>
> In [45]: Not(Contains(x, Reals))
> Out[45]: ¬x ∈ ℝ
>
> In [46]: Contains(x, ImageSet(Lambda(n, 2*n), Integers))
> Out[46]: x ∈ {2⋅n │ n ∊ ℤ}
>
> Usually it is better though to express the same statements using
> ordinary Booleans rather than Sets e.g.:
>
> In [47]: Eq(x % 2, 0)
> Out[47]: x mod 2 = 0
>
> In [51]: Ne(x % 2, 1)
> Out[51]: x mod 2 ≠ 1
>
> --
> Oscar
>
> On Mon, 4 Nov 2024 at 10:45, Paul Royik <[email protected]> wrote:
> >
> > Is there any way to represent in Sympy the following: `x is Real`, `x is 
> not odd`.
> >
> > In other words, is there a possibility to represent the fact that 
> expression belongs or doesn't belong to some set?
> >
> > --
> > 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 visit 
> https://groups.google.com/d/msgid/sympy/6803ee83-25e7-4733-a33e-36fd90fa641fn%40googlegroups.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 visit 
https://groups.google.com/d/msgid/sympy/ba26ba4c-8230-4573-9fb8-26317c59ea8cn%40googlegroups.com.

Reply via email to