Questions tagged [negation]

Negation is the logic operation that inverses a value, also seen as a NOT operation. Functions in specific languages may operate with negation to specific uses. For questions specific to the use of complement patterns in regular expressions, use [regex-negation] instead.

Negation is the logic operation that inverses a value, also seen as a NOT operation. Negation may be implemented by specific languages to provide functions capable of operating with values for specific uses.

Read also the wikipedia article on Negation.

248 questions
0
votes
0 answers

Is `{}` functionally equivalent to `not null & not undefined`?

I'm in a situation where I'd like to type a value as "anything except undefined". I know the type {} represents an empty object, and since every value in JavaScript is an object except for undefined and null, {} seems to be equivalent to not null &…
Ian
  • 5,704
  • 6
  • 40
  • 72
0
votes
1 answer

do while keeps repeating even when entered the correct value C

I want to start a program of Y and N Q&A. #include #include int main(){ char answer[256]; do { print("\nDo you want to delete yourself of the record?\n"); scanf("%s", answer); printf("%s", answer); …
almrog
  • 141
  • 6
0
votes
3 answers

Negation operator on unsigned char

#include int main() { unsigned char a = 5; printf("%d\n",~a); printf("%d\n",a=~a); return 0; } According to the accepted answer here Negation inside printf , in the first printf, a should get promoted to an int and the…
Stupid Man
  • 885
  • 2
  • 14
  • 31
0
votes
1 answer

Negation in np.select() condition

Here is my code: import pandas as pd import numpy as np df = pd.DataFrame({ 'var1': ['a', 'b', 'c',np.nan, np.nan], 'var2': [1, 2, np.nan , 4, np.nan] }) conditions = [ (not(pd.isna(df["var1"]))) &…
vasili111
  • 6,032
  • 10
  • 50
  • 80
0
votes
1 answer

Does SWRL support classical negation in Protege?

I wanted to try the following rule: (not Person)(?x) -> NonHuman(?x) which is provided here - https://github.com/protegeproject/swrlapi/wiki/SWRLLanguageFAQ#does-swrl-support-classical-negation and i got this: Is classical negation supported in…
mastaofthepasta
  • 91
  • 1
  • 2
  • 9
0
votes
0 answers

Negation (!) does not change the outcome of preg_match in PHP

When I apply a negation ! to preg_match, I expect the result of the test to be reversed. Yet this doesn't happen. ";} else{echo…
shau
  • 15
  • 4
0
votes
2 answers

Using Negation operator in neo4j,

match (a)-[r:friend_of]-(b) where a.name='john' return b.name in this case it will giving all the nodes which are [r:friend_of] relation with john, but, I want those who are not [r:friend_of] relation with john so, can any plz help me, thanks in…
manjunath
  • 1
  • 1
0
votes
1 answer

Do-while Loop Conditional Statement Negation Equivalence

New to the community and programming. I was curious as to why these two logical statements are equivalent in my program. I can't seem to wrap my head around this specific logic at the moment, and I wanted to understand why it works this…
0
votes
0 answers

Can a regex expression on javascript be started with an exclamation mark?

Okay so let me be clear about this, I have a user interface where a user can search for products based on their product title, and the way it's built is that you don't need to type the full exact title to get a match. Basically under the hood it…
TiagoM
  • 3,458
  • 4
  • 42
  • 83
0
votes
0 answers

Requiring single negated query not working

I have a system at my hand that generates solr queries. -(+(id:34)) returns everything that does not have id 34, which is correct +(-(+(id:34))) does not return any result, but as of my understanding should return exactly the same result solr…
user11592903
0
votes
2 answers

What do we mean by if (!string) in C

I am trying to modify a code to adjust it to my liking. In order to do so I needed to understand what do we mean by if (!String) in C language if someone has any ideas ? Example : const char *String; if (!String) { //do something }
0
votes
1 answer

Is there a way to find 'not' of a binary vector using some matrix-vector operation?

Is there a way to find the negation (i.e. logical not) of a binary vector by doing some matrix-vector operation on the original vector? Let's say we have a binary vector x = [1 0 1 1]. One can easily say that negation form of x is [0 1 0 0]. How…
Ash
  • 117
  • 11
0
votes
1 answer

Having trouble getting jQuery "not" method and selector working on body element

I'm having a hard time trying to understand why this is not working as expected. I simply am trying to target the body element, but only if does not contain the .logged-in class, but with the code below I get a log to the console whether the class…
Brett
  • 19,449
  • 54
  • 157
  • 290
0
votes
1 answer

Turn into negation form

I am new to logic and also I like to learn artificial intelligence. I am suffering to convert the following sentences into negation form. I have tried but still i have in confuse. Please help me whether the following result are correct or not. (i)…
0
votes
2 answers

prolog question find maximum using negation operator \+

I have got some values H, and I would like to find the maximum one using \+, how can i do it? maxValue(X) :- Get(Id, X), \+( Get(Id, Y), X < Y ). don't have a clue....please help, thanks!
Tom
  • 19
  • 2
  • 2
  • 3