From af9b56dd366cf6bf40c340d2d8367105b38cbd21 Mon Sep 17 00:00:00 2001 From: Ant19801108 Date: Thu, 10 Sep 2026 21:06:05 +0200 Subject: [PATCH] fix: correct argument order in fuzzy set union FuzzySet is declared as (name, left_boundary, peak, right_boundary), but union passed (name, min_left, max_right, avg_peak), so peak and right_boundary were swapped. Swap the last two arguments and update both doctests. Fixes #11871 Signed-off-by: Ant19801108 --- fuzzy_logic/fuzzy_operations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fuzzy_logic/fuzzy_operations.py b/fuzzy_logic/fuzzy_operations.py index c5e4cbde019d..37833b119b16 100644 --- a/fuzzy_logic/fuzzy_operations.py +++ b/fuzzy_logic/fuzzy_operations.py @@ -57,7 +57,7 @@ class FuzzySet: # Union Operations >>> siya.union(sheru) - FuzzySet(name='Siya U Sheru', left_boundary=0.4, peak=0.7, right_boundary=1.0) + FuzzySet(name='Siya U Sheru', left_boundary=0.4, peak=1.0, right_boundary=0.7) """ name: str @@ -147,13 +147,13 @@ def union(self, other) -> FuzzySet: FuzzySet: A new fuzzy set representing the union. >>> FuzzySet("a", 0.1, 0.2, 0.3).union(FuzzySet("b", 0.4, 0.5, 0.6)) - FuzzySet(name='a U b', left_boundary=0.1, peak=0.6, right_boundary=0.35) + FuzzySet(name='a U b', left_boundary=0.1, peak=0.35, right_boundary=0.6) """ return FuzzySet( f"{self.name} U {other.name}", min(self.left_boundary, other.left_boundary), - max(self.right_boundary, other.right_boundary), (self.peak + other.peak) / 2, + max(self.right_boundary, other.right_boundary), ) def plot(self):