Question

This problem requires using R studio. This question is from Verzani (Problem 2.15) Can some write...

This problem requires using R studio. This question is from Verzani (Problem 2.15) Can some write the code for the answer to the question below:

The negation operator ! is used with reverse Boolean values. For example:

A <- c(True, False, True, False)

!A

##[1] False True False False

One of De Morgan's laws in R code is ! (A & B) = !A | !B . Verify this with B <- c(False, True, False, True) and A as above.

Homework Answers

Answer #1

R-code:

A <- c(TRUE, FALSE, TRUE, FALSE)

B <- c(FALSE, TRUE, FALSE, TRUE)

C=A&B

C

!C

!A

!B

D=!A | !B

D

Output:

> A <- c(TRUE, FALSE, TRUE, FALSE)
>
> B <- c(FALSE, TRUE, FALSE, TRUE)
>
> C=A&B
>
> C
[1] FALSE FALSE FALSE FALSE
>
> !C
[1] TRUE TRUE TRUE TRUE
>
> !A
[1] FALSE TRUE FALSE TRUE
>
> !B
[1] TRUE FALSE TRUE FALSE
>
> D=!A | !B
>
> D
[1] TRUE TRUE TRUE TRUE

Comment: Since !C=!(A & B) & D=!A | !B are same , this proves De Morgan's laws ! (A & B) = !A | !B .

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
This problem requires using R studio. This question is from Verzani (Problem 2.56) Can some write...
This problem requires using R studio. This question is from Verzani (Problem 2.56) Can some write the code for the answer to the question below: The Michelson(HistData) data set records 100 measurements by Michelson of the speed of light (in the variable velocity). Make a quantile-normal graph and discuss if the graphic shows the points falling on a straight line.
This problem requires using R studio. This question is from Verzani (Problem 6.25) Can some write...
This problem requires using R studio. This question is from Verzani (Problem 6.25) Can some write the code for the answer to the question below: A q-q plot is an excellent way to investigate whether a distribution is approximately normal. For the symmetric distributions Uniform (0,1), Normal (0,1), and t with 3 degrees of freedom, take a random sample of size 100 and plot a quantile-normal plot using qnorm. Compare the three and comment on the curve of the plot...
Question 1 Consider the following compound inequality: -2 < x < 3 a) Explain why this...
Question 1 Consider the following compound inequality: -2 < x < 3 a) Explain why this compound inequality is actually a conjunction. Write this algebraic statement verbally. b) Is the conjunction TRUE or FALSE when x = 3? Justify your answer logically (not algebraically!) by arguing in terms of truth values. Question 2 Write verbally the negation of the following statement: "Red mangos are always sweet while green mangos are sometimes sour." Do not forget to apply De Morgan's laws...
The following question can be answered in R code (using R-Studio or a program of your...
The following question can be answered in R code (using R-Studio or a program of your choice). Load the “star” data from the “faraway” package, and model “temp” using “light”. One may also suspect that the residuals (use all the data) follow a t distribution instead of normal. Using the same logic that we produced the QQ plot for comparing to the normal distribution, produce a QQ plot for comparing to a t distribution. You need to decide the degrees...
By using the R-Studio answer the following question: 1. a) write a simple loop to list...
By using the R-Studio answer the following question: 1. a) write a simple loop to list the squares of the first 10 integers. b) Generate the 10*10 matrix A, whose (i;j) entry is sin(2*pi*(i-j))
This question comes from R studio statistical software. For a comparison between two means, what information...
This question comes from R studio statistical software. For a comparison between two means, what information will the R code below provide? > power.t.test(n=6, delta=NULL, sd=2.2, sig.level=0.05, power=0.8) Group of answer choices A.) The number of replications needed to achieve the stated level of power B.) The effect size (detectable difference) at the stated level of power C.) The Type I error rate
This problem requires the use of R-Studio. Consider the mtcars data. In R, you can use...
This problem requires the use of R-Studio. Consider the mtcars data. In R, you can use the following code to get the data: dta <- mtcars Use ?mtcars to read the information about this data set. In what follows, we will fit the regression model: mpgi=β0 + β0vsi+ εi, i=1,2,...,n. Note that, vs is categorical variable, whose value is 1 if the observed car has the V-shaped engine or 0 otherwise. (A) Which of the following is the most accurate...
(a) Write an algorithm (use pseudo-code) to determine whether a function f ∶ Z100 → Z100...
(a) Write an algorithm (use pseudo-code) to determine whether a function f ∶ Z100 → Z100 is surjective. That is, supply a “Method” to go with Input: A function (array) f with f(i) ∈ Z100 for i = 0, 1, . . . , 99. Output: Boolean B. B=‘true’ if f is surjective, ‘false’ otherwise. Try to make your algorithm as efficient as possible. Do NOT include an implementation of your algorithm in a programming language. (b) How many comparisons...
Question 53 (1 point) Transcription of RNA from RNA is not a normal cellular process. Question...
Question 53 (1 point) Transcription of RNA from RNA is not a normal cellular process. Question 53 options: A) True B) False Question 54 (1 point) At the time of Louis Pasteur and Robert Koch, the term"virus" was used to refer to: Question 54 options: anthrax etiologic agent of tuberculosis cholera etiologic agent of syphilis all of the above Question 55 (1 point) Which of the following types of animal virus requires RNA-dependent RNA polymerase for replication? Question 55 options:...
is there anything wrong with the solution. the question are from java course Write a main...
is there anything wrong with the solution. the question are from java course Write a main method that will request the user to enter Strings using a JOptionPane input dialog. The method should continue accepting strings until the user types “STOP”.       Then, using a JOptionPane message dialog, tell the user how many of the strings begin and end with a digit. Answer: import javax.swing.*; public class IsAllLetters {     public static void main(String[] args) {         String input;         int count =...