Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Fuuzzy logic in Mathcad

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-26-2014
11:13 PM

11-26-2014
11:13 PM

Fuuzzy logic in Mathcad

Fuzzy logic ln Mathcad

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

Not fuzzy logic

Fuzzy logic

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

Labels:

24 REPLIES 24

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
05:28 AM

11-27-2014
05:28 AM

Re: Fuuzzy logic in Mathcad

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
06:15 AM

11-27-2014
06:15 AM

Re: Fuuzzy logic in Mathcad

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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
06:50 AM

11-27-2014
06:50 AM

Re: Fuuzzy logic in Mathcad

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
07:21 AM

11-27-2014
07:21 AM

Re: Fuuzzy logic in Mathcad

Adrien Thurin wrote:

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

mean(J)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
07:26 AM

11-27-2014
07:26 AM

Re: Fuuzzy logic in Mathcad

mean(J) won't work.

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
07:48 AM

11-27-2014
07:48 AM

Re: Fuuzzy logic in Mathcad

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
08:22 AM

11-27-2014
08:22 AM

Re: Fuuzzy logic in Mathcad

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...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
08:00 AM

11-27-2014
08:00 AM

Re: Fuuzzy logic in Mathcad

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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
08:25 AM

11-27-2014
08:25 AM

Re: Fuuzzy logic in Mathcad

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
12:01 PM

11-27-2014
12:01 PM

Re: Fuuzzy logic in Mathcad

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-28-2014
04:26 AM

11-28-2014
04:26 AM

Re: Fuuzzy logic in Mathcad

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
01:36 PM

11-27-2014
01:36 PM

Re: Fuuzzy logic in Mathcad

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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
01:54 PM

11-27-2014
01:54 PM

Re: Fuuzzy logic in Mathcad

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
02:00 PM

11-27-2014
02:00 PM

Re: Fuuzzy logic in Mathcad

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)?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-27-2014
02:46 PM

11-27-2014
02:46 PM

Re: Fuuzzy logic in Mathcad

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-28-2014
12:10 AM

11-28-2014
12:10 AM

Re: Fuuzzy logic in Mathcad

The question is!

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

One picture from it:

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

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-28-2014
09:42 AM

11-28-2014
09:42 AM

Re: Fuuzzy logic in Mathcad

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-28-2014
10:05 AM

11-28-2014
10:05 AM

Re: Fuuzzy logic in Mathcad

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-28-2014
12:53 PM

11-28-2014
12:53 PM

Re: Fuuzzy logic in Mathcad

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-28-2014
02:26 PM

11-28-2014
02:26 PM

Re: Fuuzzy logic in Mathcad

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-28-2014
02:45 PM

11-28-2014
02:45 PM

Re: Fuuzzy logic in Mathcad

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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-28-2014
01:58 PM

11-28-2014
01:58 PM

Re: Fuuzzy logic in Mathcad

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:

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-29-2014
02:26 AM

11-29-2014
02:26 AM

Re: Fuuzzy logic in Mathcad

One more question.

Can we solve this reverse problem?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

12-03-2014
01:28 AM

12-03-2014
01:28 AM

Re: Fuuzzy logic in Mathcad

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