cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Fuuzzy logic in Mathcad

ValeryOchkov
24-Ruby IV

Fuuzzy logic in Mathcad

Fuzzy logic ln Mathcad

(see please the begin of discussion - http://communities.ptc.com/message/264608)

Not fuzzy logic

verdict1.png

Fuzzy logic

verdict2.png

One question. What is the function Verdict not fot 3 but for n (12 for example) jorors?

24 REPLIES 24
athurin
4-Participant
(To:ValeryOchkov)

If I understand properly you want to make your inputs "vote".

Here is an example of verdict function for 12 voters, with votes in a vector. I don't like it very much, because you have to re-write the function when you change the number of voters (can someone adapt it to make a version that will make it work with any number of voters in a single function ?), but I think it should be reasonably straightforward to adapt.

Adrien Thurin wrote:

If I understand properly you want to make your inputs "vote".

Here is an example of verdict function for 12 voters, with votes in a vector. I don't like it very much, because you have to re-write the function when you change the number of voters (can someone adapt it to make a version that will make it work with any number of voters in a single function ?), but I think it should be reasonably straightforward to adapt.

I haven't spent much time on it, but wouldn't the following to the job as well?

1.png

athurin
4-Participant
(To:Werner_E)

Awesome ! I don't think it is possible to make any simpler that that !

Except that it doesn't look for the right value when there is an even number of voters, so I woulddrop the "-1" in the index.

Adrien Thurin wrote:

Awesome ! I don't think it is possible to make any simpler that that !

mean(J)

athurin
4-Participant
(To:ValeryOchkov)

mean(J) won't work.

If you have J:=[1 1 0], you want V(J)=1, but mean(J)=2/3.

Adrien Thurin wrote:

mean(J) won't work.

If you have J:=[1 1 0], you want V(J)=1, but mean(J)=2/3.

Fuzzy logic

athurin
4-Participant
(To:ValeryOchkov)

Valery Ochkov wrote:

Adrien Thurin wrote:

mean(J) won't work.

If you have J:=[1 1 0], you want V(J)=1, but mean(J)=2/3.

Fuzzy logic

Well, I am not an expert but I thought that fuzzy logic was a superset of "regular" logic. Meaning that if you input 1s and 0s in a fuzzy logic system, you should get 1s and 0s on the output. Or am I wrong ? Because that's what your fuzzy Or and And functions do...

But again, I am not an expert...

Adrien Thurin wrote:

Awesome ! I don't think it is possible to make any simpler that that !

Except that it doesn't look for the right value when there is an even number of voters, so I woulddrop the "-1" in the index.

Shouldn't it look for the sixth element at index 5 (ORIGIN=0) when we have 12 voters?

1.png

athurin
4-Participant
(To:Werner_E)

I guess that's debatable. Do you want an absolute majority (element 7 at index 6), or do 1s win over 0s in case of draw (element 6 at index 5) ?

I would argue that you should have an odd number of voters, as much as possible, to avoid this issue.

Either way, that would be the person who asked the question's decision to make.

Adrien Thurin wrote:

I guess that's debatable. Do you want an absolute majority (element 7 at index 6), or do 1s win over 0s in case of draw (element 6 at index 5) ?

I would argue that you should have an odd number of voters, as much as possible, to avoid this issue.

Either way, that would be the person who asked the question's decision to make.

Yes. I just wanted to point out that my routine duplicates what your routine does.

athurin
4-Participant
(To:Werner_E)

In which case, that's my mistake. It wasn't intended that way.

I would like to now opinion on my lecture from my students

(here is my students - see, please http://communities.ptc.com/videos/3543)

  • very good -1
  • good 0.8
  • more good than bed 0.7
  • fifty-fifty 0.5
  • more bed than good 0.3
  • bed 0.2
  • very bed 0

The result is mean (V)

Or?

Looks like you forgot which question you asked at the very beginning of this thread 😉

Werner Exinger wrote:

Looks like you forgot which question you asked at the very beginning of this thread 😉

I cannot remember all my questions

But the question was

One question. What is the function Verdict not fot 3 but for n (48 students for example)?

Valery Ochkov wrote:

Werner Exinger wrote:

Looks like you forgot which question you asked at the very beginning of this thread 😉

I cannot remember all my questions

But the question was

One question. What is the function Verdict not fot 3 but for n (48 students for example)?

Yes, that was your question at the thread start and while I am not sure because I have not dealt intensively with it, I nevertheless think Adrien and me have given answers. mean() is not a correct answers as mean() returns something completely different. The result of mean() may be useful, but is different from the verdict() function you provided at the beginning.

BTW, median(V) is working (means: can be used as verdict()) for an odd number of jurors but not for an even one because in the latter case is will return the mean of the two center elements and not one of the elements themselves.

The question is!

I am writing the article "Boolean cubics or origami".

One picture from it:

bc.png

1. Are Xor and Eqv (=) cubics correct for fuzzy logic?

2. Can we plot others fuzzy logic cubics (create origami) using this table?

tab2.png

1. Are Xor and Eqv (=) cubics correct for fuzzy logic?

Equivalance seems to be wrong. Equivalence (XNOR) is the neagtion of antivalence (XOR).

2. Can we plot others fuzzy logic cubics (create origami) using this table?

Why not? You can create all with combinations of AND, OR and NOT.

1.png

Thanks!

But sorry - XOR is Not(Equal), and Equal(0.5, 0.5)=1, not 0.5. Equal(a, b):= 1-| a-b|.

And second.

We can create all (17!) function by using only one, not three.

Valery Ochkov wrote:

Thanks!

But sorry - XOR is Not(Equal),

Correct, thats exactly what i was telling you. I just said it the other way round: XNOR=NOT(XOR). And XNOR is usually called equivalence 😉

and Equal(0.5, 0.5)=1,

Thats what intuition is prrobably telling you, but we are talking about fuzzy logic. Of course all is a matter of definition and implementing fuzzy XNOR and XOR connectives can be done in different ways - the latest approach I am aware of is this http://link.springer.com/article/10.1007/s00500-011-0708-1#page-1.

I sticked to a more traditional definition which can be found in a number of books, e.g. in Fuzzy Thinking: The New Science of Fuzzy Logic by Bart Kosko.

In this book the truth value for equal for fuzzy bits is given by ((A&B) | (not(B)&Not(A)). Thats XNOR and I just used an equivalent definition.

You may compare it to probability calculation: If you have two fuzzy bits with a value of 0.5, they both can be either 0 or 1 (in a perfect binary world). So the probability that they are equal (either both 1 or both 0) is 0.5, not 1.

I also found a nice definition for XOR in the German Wikipedia http://de.wikipedia.org/wiki/Fuzzylogik#Nicht_ausschlie.C3.9Fende-ODER-Schaltung

According to that source XOR should be the minimum of the negation of the smaller of the two values and the other. While this sounds different, the outcome is exactly what my implementation does.

Equal(a, b):= 1-| a-b|.

A different definition - where stems it from? Can you name a source? This would imply that XOR should be |a-b|. Is it this what you want? Then XOR would look differently to what you showed.

BTW, you sure have already noticed it: I had mixed up equivalence and antivalence in the picture I posted. Of course XNOR is equivalence.

Werner Exinger wrote:

We can create all (17!) function by using only one, not three.

???????

We can base only on NOR and create last 16 function: not, and, or et

Valery Ochkov wrote:

Werner Exinger wrote:

We can create all (17!) function by using only one, not three.

???????

We can base only on NOR and create last 16 function: not, and, or et

Yes, we can build any circuit with NORs, but it can get a bit awkward.

What about your definition of XNOR (eqv) - any source?

As you seem to be much interested in the 3D-plot which reminds you to Origami. You may try different t-norm / t-conorm for AND / OR, maybe the one credited to Lukasiewicz himself:

2.png

Here is yet another well known t-norm but this time without associations to origami.

1.png

One more question.

Can we solve this reverse problem?

RevTask.png

It is said that in the US the electric chair brought into lethal effect several people. In this case, the present switch is operated by only one person. Other participants include the execution of this fake breakers. And no one knows where the fake, and where the real switch. This procedure is somewhat hypocritical allows each such executioner think that not he but someone else was the cause of death. If all of these circuit breakers replaced by rheostats (See below. Fig. 14), a smoothly varying voltage, death can be replaced by non-lethal punishment: sentenced offender will receive an electric shock (strong or weak), but remain alive.

Is it true?

Or more correct question:

It is true - 1

It is more truethan false - 0.75

50-50

It is more false than true - 0.25

It is false - 0

Top Tags