# And

Instance of: logic

AKA:

Distinct from:

English:

Formalization:



Cites: Wikipedia ; Wikidata ; Wolfram

Code

Examples:

a=TRUE
b=FALSE
a & b
[1] FALSE

Examples:

Note do not use & or you will get a different result

a=True
b=False
a and b
False

Note do not use & or you will get a different result &’ is a bitwise operator in Python that acts on bits and performs bit by bit operation

https://www.geeksforgeeks.org/difference-between-and-and-in-python/#:~:text=and%20is%20a%20Logical%20AND,otherwise%20True%20when%20using%20logically.

a=14
b=4
a & b
4

https://numpy.org/doc/stable/reference/generated/numpy.logical_and.html

Examples:

import numpy as np
a=np.array(True)
b=np.array(False)
np.logical_and(a, b)
False

Examples:

import jax.numpy as jnp
a=jnp.array(True)
WARNING:jax._src.lib.xla_bridge:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
b=jnp.array(False)
jnp.logical_and(a, b)
DeviceArray(False, dtype=bool)

https://www.w3schools.com/sql/sql_operators.asp https://www.databasestar.com/sql-boolean-data-type/#:~:text=SQL%20Server%20Boolean,TRUE%20and%200%20for%20FALSE.

library(DBI)
# Create an ephemeral in-memory RSQLite database
#con <- dbConnect(RSQLite::SQLite(), dbname = ":memory:")
#dbListTables(con)
#dbWriteTable(con, "mtcars", mtcars)
#dbListTables(con)

#* deb: libpq-dev libssl-dev (Debian, Ubuntu, etc)
#install.packages('RPostgres')
#remotes::install_github("r-dbi/RPostgres")
#Took forever because my file permissions were broken
#pg_lsclusters
require(RPostgres)
Loading required package: RPostgres
# Connect to the default postgres database
#I had to follow these instructions and create both a username and database that matched my ubuntu name
#https://www.digitalocean.com/community/tutorials/how-to-install-postgresql-on-ubuntu-20-04-quickstart
con <- dbConnect(RPostgres::Postgres())
SELECT TRUE AND FALSE;
1 records
?column?
FALSE
SELECT TRUE AND TRUE;
1 records
?column?
TRUE

https://pytorch.org/docs/stable/generated/torch.logical_and.html

import torch
a = torch.tensor(True)
b = torch.tensor(False)
torch.logical_and(a, b)
tensor(False)

### 0.0.1 Tensorflow

https://www.tensorflow.org/api_docs/python/tf/math/logical_and

import tensorflow as tf
a = tf.constant(True)
b = tf.constant(False)
tf.math.logical_and(a, b)
<tf.Tensor: shape=(), dtype=bool, numpy=False>