Confused about conditional statements and vectors?

In summary, conditional statements are programming constructs that allow a program to make decisions based on certain conditions. They can be of different types, such as if-else statements, switch statements, and ternary operators, and can be used to manipulate data stored in vectors. Conditional statements can also be nested, but some common mistakes when using them include forgetting to include a default case and using the wrong comparison operator.
  • #1
cytochrome
166
3
A conditional statement is of the form A→B.

Truth tables suggest that the converse, B→A ≠ A→B.

It is also known that any two vectors A and B are perpendicular if and only if their dot products are zero.


My confusion is...

A dot B = 0 → A and B are perpendicular. The converse is also true. Why does this not agree with truth tables?
 
Physics news on Phys.org
  • #2
I just realized that "if and only if" is a biconditional statement, so the converse of A⇔B is also true.

I think this clears up my confusion, correct me if I'm wrong please.
 

Related to Confused about conditional statements and vectors?

What are conditional statements and how do they work?

Conditional statements are programming constructs that allow a program to make decisions based on certain conditions. They typically follow an "if-then" logic, where a certain block of code is executed if a given condition is met.

What are the different types of conditional statements?

There are several types of conditional statements, including if-else statements, switch statements, and ternary operators. Each type has its own syntax and use cases, but they all serve the same purpose of allowing a program to make decisions based on conditions.

How do conditional statements relate to vectors?

Vectors, or arrays, can be used in conditional statements to store and manipulate data. For example, a program might use a vector to store a list of numbers and then use a conditional statement to check if a certain number is present in the vector.

Can conditional statements be nested?

Yes, conditional statements can be nested within each other. This means that an if-else statement can contain another if-else statement within its code block. This allows for more complex decision-making in a program.

What are some common mistakes when using conditional statements and vectors?

One common mistake is forgetting to include a default case, such as an else statement, in an if-else statement. This can result in unexpected behavior if the condition is not met. Another mistake is using the wrong comparison operator, such as using "=" instead of "==" in a conditional statement, which can lead to unintended results.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Precalculus Mathematics Homework Help
Replies
5
Views
647
  • Linear and Abstract Algebra
Replies
33
Views
969
  • Linear and Abstract Algebra
Replies
9
Views
306
  • Linear and Abstract Algebra
Replies
14
Views
743
  • Set Theory, Logic, Probability, Statistics
Replies
14
Views
2K
Replies
2
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
2K
Replies
6
Views
184
  • Linear and Abstract Algebra
Replies
9
Views
652
Back
Top