Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-25-2006, 06:24 PM   PM User | #1
sulli1
New Coder

 
Join Date: Jan 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
sulli1 is an unknown quantity at this point
Truth Table Question

Hi All,

Please could somebody advise me on my query about truth tables?

Is

NOT (NOT A AND B) as shown below

A B
T T
F F

and does

A OR NOT B mean the same thing?

A B
T T
F F

This was part of a question in an assignment that I had to submit by yesterday, which I did, but unfortunately I still don't think I have the gist of this!

Thank you in advance.
sulli1 is offline   Reply With Quote
Old 01-25-2006, 07:31 PM   PM User | #2
GJay
Senior Coder

 
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
GJay is on a distinguished road
Not quite sure what this has to do with Javascript, and my formal logic is a bit rusty, but basically, it depends what you mean by 'means the same as'. As I remember, there are two ways of saying this with logic, 'entailment' and something else that I forget the term for, |= and |- if you're writing them I believe.
Dpending on which you want to use, then the answer is 'yes' or 'no', but I forget which way round. If you have a textbook for this, then it will probably tell you, as I think this was an example of the difference on our course.

I could, of course, be getting confed, and this might all be wrong.
GJay is offline   Reply With Quote
Old 01-25-2006, 07:44 PM   PM User | #3
sulli1
New Coder

 
Join Date: Jan 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
sulli1 is an unknown quantity at this point
Question

Hi GJay,

Thanks for your reply to my query. The truth table was part of an assignment that I have just had to submit in my Javascript course, so although I am having trouble getting my head around it it must have something to do with Javascript somewhere along the line. The problem I am having is with the double negative, ie; does NOT (NOT A AND B) mean it is A and B, ie; A is True and B is True? The way I have written the table is exactly how it was posed in the test paper.

Thanks for trying to help though.

Kindest regards,

Jenny
sulli1 is offline   Reply With Quote
Old 01-25-2006, 09:46 PM   PM User | #4
GJay
Senior Coder

 
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
GJay is on a distinguished road
Code:
a=array(true,false);
b=array(true,false);
i=0;
while(i<a.length) {
  j=0;
  while(j<b.length) {  
    alert((!(!a[i]&&!b[j]))==(a[i]||!b[j]));
    j++;
  }
  i++;
}
Will show whether the statement:
!(!a&&!b))=a||!b
is always true (i.e. each side is the same)
GJay is offline   Reply With Quote
Old 01-25-2006, 11:52 PM   PM User | #5
sulli1
New Coder

 
Join Date: Jan 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
sulli1 is an unknown quantity at this point
Hi GJay,

Thank you for your coding, I really appreciate your help.


Kindest regards,

Jenny
sulli1 is offline   Reply With Quote
Old 01-26-2006, 01:13 AM   PM User | #6
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Just use DeMoivre's theorem:

!(!A & B) = !!A | !B = A | !B

Thus, NOT (NOT a AND b) is equivalent to: a OR NOT b
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:00 PM.


Advertisement
Log in to turn off these ads.