Calculate the union of this fuzzy set with another fuzzy set. Args: other (FuzzySet): Another fuzzy set to union with. Returns: FuzzySet: A new fuzzy set representing the union. >>> FuzzySet("a", 0.1, 0.2, 0.3).union(FuzzySet("b", 0.4, 0.5, 0
(self, other)
| 139 | raise ValueError(msg) |
| 140 | |
| 141 | def union(self, other) -> FuzzySet: |
| 142 | """ |
| 143 | Calculate the union of this fuzzy set with another fuzzy set. |
| 144 | Args: |
| 145 | other (FuzzySet): Another fuzzy set to union with. |
| 146 | Returns: |
| 147 | FuzzySet: A new fuzzy set representing the union. |
| 148 | |
| 149 | >>> FuzzySet("a", 0.1, 0.2, 0.3).union(FuzzySet("b", 0.4, 0.5, 0.6)) |
| 150 | FuzzySet(name='a U b', left_boundary=0.1, peak=0.6, right_boundary=0.35) |
| 151 | """ |
| 152 | return FuzzySet( |
| 153 | f"{self.name} U {other.name}", |
| 154 | min(self.left_boundary, other.left_boundary), |
| 155 | max(self.right_boundary, other.right_boundary), |
| 156 | (self.peak + other.peak) / 2, |
| 157 | ) |
| 158 | |
| 159 | def plot(self): |
| 160 | """ |
no test coverage detected