max yue
max yue

Reputation: 415

(1,2) is a subset of (0, 3), but how can I represent this in sympy?

(1,2) is a subset of (0, 3), but how can I represent this in SymPy?

a = Interval(1,2)
b = Interval(0,3)

I want to represent a is a subset of b in SymPy, but I can't figure out how to do so.

Upvotes: 1

Views: 65

Answers (1)

miradulo
miradulo

Reputation: 29690

You can check whether a is a subset of b directly with is_subset.

>>> Interval(1, 2).is_subset(Interval(0, 3))
True

There are a vast number of other set operations in SymPy.sets.

Upvotes: 2

Related Questions