Legacy Documentation

Fuzzy Logic (2004)

This is documentation for an obsolete product.
Current products and services

 Documentation /  Fuzzy Logic /  Manual /

Fuzzy ArithmeticLukasiewicz Sets and Logic

1.10 Discrete Fuzzy Arithmetic

1.10.1 Introduction

Fuzzy Logic provides a number of functions for performing fuzzy arithmetic. In this chapter, we will demonstrate these functions and the options associated with each function.

This loads the package.

In[1]:=

In this package, all of the fuzzy sets are defined in the discrete space. This enables us to perform some quick, discrete fuzzy arithmetic operations on fuzzy sets. In this chapter, we examine a couple of arithmetic operations, which are well-defined in real space, and compare the discrete results with the real space results.

To begin, we must create some fuzzy sets. We will do this later, but first let's extend the default universal space, so we have more room to work.

In[2]:=

When working with the fuzzy arithmetic operations in this package, it is important to choose a proper universal space. The universal space should range from a negative value to the corresponding positive value. This is because fuzzy arithmetic operations often involve working with the image of the fuzzy set, a fuzzy set flipped around zero.

Another consideration is that the result of an arithmetic operation should be contained in the same universal space as the numbers used in the calculation. By choosing a large universal space, you can ensure that the results will fall in the universal space, but the calculations can take longer, and the graphs may be difficult to read. A general rule for setting the universal space is to find the smallest universal space that is still big enough to represent all possible results.

Now we create some fuzzy sets. The first two fuzzy sets we create are triangular fuzzy sets and the second two are Gaussian fuzzy sets. These two types of fuzzy sets are both commonly used to represent fuzzy numbers. For more information on creating fuzzy sets, see the Chapter 1.1 Creating Fuzzy Sets.

In[3]:=

In[4]:=

In[5]:=

In[6]:=

We use the FuzzyPlot function to see what our initial fuzzy sets look like.

In[7]:=

In[8]:=

1.10.2 Discrete Arithmetic on Triangular Fuzzy Numbers

Discrete arithmetic functions for triangular fuzzy numbers.

As mentioned earlier, triangular fuzzy sets are common representations of fuzzy numbers. Triangular fuzzy numbers are convenient to work with because in real space, adding two triangular fuzzy numbers involves adding the corresponding vertices used to define the triangular fuzzy numbers. Similar simple formulas can be used to subtract or find the image of triangular fuzzy numbers. Because of these properties, we demonstrate the discrete arithmetic operations with triangular fuzzy numbers and compare the results with the expected results if the fuzzy sets were defined in real space.

Fuzzy Addition

DiscreteFuzzyPlus[A, B] returns a fuzzy set that is the result of applying fuzzy addition to fuzzy sets A and B. We add our first two fuzzy sets and plot the results.

In[9]:=

In[10]:=

In[11]:=

Based on earlier discussion, the sum of the two triangular fuzzy sets in real space should be a triangular fuzzy set with vertices at {1 + 4, 5 + 10, 5 + 10, 9 + 16} or {5, 15, 15, 25}. To evaluate the results of the discrete fuzzy addition, we plot the expected real space result with our discrete result.

In[12]:=

In[13]:=

From the graph we see that the discrete fuzzy sum is bounded above by the expected fuzzy set for real space. This is the case for all of the discrete fuzzy arithmetic operations.

Fuzzy Subtraction

DiscreteFuzzyMinus[A, B] returns a fuzzy set that is the result of applying fuzzy subtraction to fuzzy sets A and B. We will subtract our first fuzzy set from the second one and plot the results.

In[14]:=

In[15]:=

In real space the difference between the two triangular fuzzy sets would be a triangular fuzzy set with vertices at {1 - 16, 5 - 10, 5 - 10, 9 - 4} or {-15, -5, -5, 5}. To evaluate the results of the discrete fuzzy subtraction, we plot this expected result with the discrete result.

In[16]:=

In[17]:=

Fuzzy Multiplication

DiscreteFuzzyMultiply[A, B] returns a fuzzy set that is the result of performing a discrete fuzzy multiplication of fuzzy sets A and B. Since fuzzy multiplication causes a fuzzy number to be quite spread out, we use a smaller fuzzy number, TriFS3, to demonstrate the fuzzy multiplication.

In[18]:=

In[19]:=

In[20]:=

In[21]:=

Fuzzy Image

DiscreteFuzzyImage[A] returns a fuzzy set that is the image of fuzzy set A. We will find the image of our first fuzzy set and plot the results here.

In[22]:=

In[23]:=

In the graph, the fuzzy set to the right is our original fuzzy set, and the fuzzy set to the left is the image of the original fuzzy set. In the discrete case, the image of a fuzzy set will look the same as it would in real space.

MAX and MIN Functions

To introduce a meaningful ordering of fuzzy numbers, we may extend the lattice operations min and max on real numbers to corresponding operations on fuzzy numbers, MIN and MAX. A partial ordering for comparable fuzzy numbers is defined as A PrecedesEqual B iff MIN(A, B) = A or, alternatively A PrecedesEqual B iff MAX(A, B) = B.

MAX[A, B] returns the fuzzy maximum of the fuzzy numbers A and B.

In[24]:=

In[25]:=

In[26]:=

In[27]:=

In[28]:=

In[29]:=

Out[29]=

MIN[A, B] returns the fuzzy minimum of the fuzzy numbers A and B.

In[30]:=

In[31]:=

In[32]:=

Out[32]=

In our example fs1 < fs2.

Note that the symbols MIN and MAX, which denote the introduced operations on fuzzy numbers, must be distinguished from the symbols min and max, which denote the operations of minimum and maximum on real numbers, respectively.

1.10.3 Discrete Arithmetic on Gaussian Fuzzy Numbers

Using Gaussian fuzzy sets is another common way to represent fuzzy numbers. Gaussian fuzzy numbers are convenient to work with because in real space, adding two Gaussian fuzzy numbers involves adding the means and standard deviations used to define the original Gaussian fuzzy numbers. To subtract two Gaussian fuzzy numbers, subtract the means and add the standard deviations. Because of these properties, we further demonstrate the discrete arithmetic operations using Gaussian fuzzy numbers.

Discrete arithmetic functions for Gaussian fuzzy numbers.

Fuzzy Addition

We start by adding the two Gaussian fuzzy numbers created earlier, and we plot the results.

In[33]:=

In[34]:=

Notice that when two Gaussian fuzzy numbers are added, the universal space is doubled.

As discussed above, after adding two Gaussian fuzzy sets defined in real space, the result is a Gaussian fuzzy set with the mean and standard deviation equal to the sum of the means and standard deviations of the original fuzzy sets. In our example, we expect to get a result with a mean of 5 + 9 = 14 and a standard deviation of 3 + 5 = 8. We can examine the results of our discrete fuzzy addition by plotting it with the expected results.

In[35]:=

In[36]:=

Again, as with triangular fuzzy numbers, the discrete fuzzy sum is bounded above by the expected result in real space. This will be true for all fuzzy arithmetic operations.

Fuzzy Subtraction

Here we subtract the two Gaussian fuzzy numbers and plot the result.

In[37]:=

In[38]:=

The expected fuzzy difference for our example would be a Gaussian fuzzy set with a mean of 5 - 9 = -4 and a standard deviation of 3 + 5 = 8. We plot the discrete result with this expected result below.

In[39]:=

In[40]:=

Fuzzy Multiplication

We can perform a discrete fuzzy multiplication with Gaussian fuzzy numbers, but since Gaussian fuzzy sets are defined for every element in the universal space, the result would be defined on a large universal space. If we multiplied our two Gaussian fuzzy sets from this notebook, the universal space would extend from -1600 to 1600, and the calculations would take a long time. For this reason, we will not demonstrate here the DiscreteFuzzyMultiply function on the Gaussian fuzzy sets.

Fuzzy Image

Here we find the image of our last fuzzy set and we plot the results.

In[41]:=

In[42]:=

The image is a fuzzy set that is the mirror image of the original fuzzy set, flipped about zero.

You can use the built-in function SetOptions to restore the default setting for the FuzzySet object.

In[43]:=

Out[43]=

Fuzzy ArithmeticLukasiewicz Sets and Logic