Floating point arithmetic

Using presented program it is possible to calculate the value of any expressions which contain floating point numbers, for example:

(1+5)/3+2

gives 4 etc.

If expression contain many lines the by default the “+” operator is assumed.

2+3
5
7*8

is equivalent to: 2+3+5+7*8 and gives the result 66.

However it is possible to change the default “+” operation by putting the operator as a first character in a line.

2+3
*
5
-7*8

is equivalent to: 2+3*5-7*8 and gives the result -39.

In the same way it is possible to define expressions which consider fuzzy and interval numbers.

Interval arithmetic

Interval number can be defined using upper Xupper and lower Xlower bounds and the brackets [,].

[Xlower, Xupper]

for example:

[1, 2]

Using the program it is possible to calculate the value of any expressions which contain interval numbers:

For example expression:

[1, 2] + [3, 4]

gives [4, 7],

[1, 2] * ([3, 4] +1)

gives [4, 10].

More information about interval arithmetic can be found here [link].

Fuzzy arithmetic

Alpha-cut of fuzzy set can be defined in the following way:

Fuzzy numbers can be defined using alpha cut. The fuzzy number which is shown on the picture can be described using three alpha cuts:

For example

{[0,1,6], [0.5, 2,5], [1,3,4]}

Each alpha-cut can be defined in the following way:

[alpha, Xlower, Xupper]

where alpha is degree of membership , Xlower and Xupper denote the upper and lower bound of the alpha cut i.e. , .

It is possible to calculate value of the expressions which contain fuzzy, interval and floating point arithmetic numbers:

{[0,1,6], [0.5, 2,5], [1,3,4]}+2*[2, 3]

gives { [ 0, 5, 12 ] [ 0.25, 5.5, 11.5 ] [ 0.5, 6, 11 ] [ 0.75, 6.5, 10.5 ] [ 1, 7, 10 ] }.

Before the calculations the program approximates given fuzzy numbers using fuzzy numbers with constant number of alpha cuts. In presented example 5 alpha cuts were used, however it is possible to change this number.

More information about fuzzy arithmetic can be found here [link]

Comments

All characters in the line after the character # are neglected by the program and can be used as comments.

For example:

1+2*(2+5) # floating-point numbers

[1,2]+[2,3] # interval numbers