Skip to content

Commit 1b623aa

Browse files
committed
Fix fuzzy set union boundaries
1 parent 6c04620 commit 1b623aa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fuzzy_logic/fuzzy_operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class FuzzySet:
5757
5858
# Union Operations
5959
>>> siya.union(sheru)
60-
FuzzySet(name='Siya U Sheru', left_boundary=0.4, peak=0.7, right_boundary=1.0)
60+
FuzzySet(name='Siya U Sheru', left_boundary=0.4, peak=1, right_boundary=0.7)
6161
"""
6262

6363
name: str
@@ -147,13 +147,13 @@ def union(self, other) -> FuzzySet:
147147
FuzzySet: A new fuzzy set representing the union.
148148
149149
>>> 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)
150+
FuzzySet(name='a U b', left_boundary=0.1, peak=0.5, right_boundary=0.6)
151151
"""
152152
return FuzzySet(
153153
f"{self.name} U {other.name}",
154154
min(self.left_boundary, other.left_boundary),
155+
max(self.peak, other.peak),
155156
max(self.right_boundary, other.right_boundary),
156-
(self.peak + other.peak) / 2,
157157
)
158158

159159
def plot(self):

0 commit comments

Comments
 (0)