Is this statement true ?
∀x ∈ R, ∃y ∈ R,(x ≥ y) ⇒ (x > y)
I believe it is not because for example if x is 5 and y is 5 it satisfies "(x ≥ y)" but it doesn't mean that it is also "(x > y)".
Am I correct ? Your input would be much appreciated.
Yes, the statement is true.
Given x in R (which I presume stands for the real numbers), let y = x - 1. Then, we need to check whether (x >= y) => (x > y) is true. Both the left and right sides of the implication are true (although only the right one needs to be), so we have true => true, which evaluates to true as well.
So, for any x you give me, I've just given you a y that makes the desired implication hold.
While the statement is true as written it doesn't mean what you probably think it does.
Edit: Interestingly, if I say, given x, let y = x + 1, then the implication statement also evaluates to true. This is because then x >= y fails, and so does x > y, so we have false => false, which also evaluates to true.
For more information, see:
http://en.wikipedia.org/wiki/Vacuous_truth
http://en.wikipedia.org/wiki/Truth_table
Related
I have to express an AND condition in linear program. The Boolean variable z takes a value 1 if both Boolean variables x and y takes a value 1. Otherwise, z takes a value 0. How do I write it in linear program?
In a pure linear program boolean expressions are not possible.
If you are in an (mixed-)integer program and x,y,z are all binary variables then you can implement the AND by the following.
z >= x+y-1
z <= x
z <= y
Here the first ensures z=1 if x=y=1 and the last two forces z=0 if any of the two is not 1.
As #Erwin Kalvelagen pointed out in the comments this is better relaxed than the formulation using 2z <= x+y.
1) x^2 + x + 1 = 0 , x is a real number.
Answer: Is a statement.
2) x^2 + x + 1 = 0 , x is complex number.
Answer: Is not a statement.
Why the question no.2 is not a statment ?
To expand on Jiale's answer:
A statement is a statement which has a definite truth value.
1) x^2 + x + 1 = 0 , x is a real number.
This can be considered a statement because it is always false regardless of how x is chosen. This is because there is no real number which satisfies this equation. Therefore, it is guaranteed to have a definite truth value: false.
2) x^2 + x + 1 = 0 , x is complex number.
This cannot be considered a statement because it is true for some complex numbers x, and false for others. The truth value of this expression is only definite once x is specified. Therefore, it is not a statement.
Reason: A Statement is a declarative statement that is either true or false but not both.
I am working on formulating an optimization problem where I have a 2-D matrix A.
A= [0 f1 0 f2]
[f3 f3 0 0]
.........
And I have another 2-D matrix B that I should fill. B has the same size of A. I need b_ij (element of B) to be zero if a_ij=0 (element of A) and I need b_ij to be greater than zero and less than or equal to a_ij if a_ij is not zero.
How can I represent this in my formulation? I have added this constraint/condition:
b_ij<=a_ij
But this does not satisfy the condition that states that b_ij is not equal zero when a_ij is not equal zero. Any help?
If all elements are positive, keep the smallest element of each matrix by doing an element by element comparison :
B2 = min(A,B)
Alternatively, create a logical matrix indicating if a condition is answered and multiply element by element with the matrix B , only elements who satisfy the condition remain, others are set to zero:
B = B.*(A~=0)
Then keep elements of B that are smaller or equal to elements of A, and replace them by the value of A otherwise.
B = B.*(B<=A) + A.*(B>A) )
This option lets you generalize your constraint.
You indicate needing elements of b_ij to be greater than zero if elements of a_ij are greater than zero. An option is to use the function max to ensure that all elements of B are positive.
B = max(1e-2,B); % exact value is yours to set.
This step is up to you and depend on your problem.
You want to implement the implication
a = 0 => b = 0
a <> 0 => 0 < b <= a
If a is (constant) data this is trivial. If a is a variable then things are not so easy.
You implemented part of the implications as
b <= a
This implies a is non-negative: a>=0. It also implies b is non-negative. The remaining implication a>0 => b>0 can now be implemented as
a <= δ * 1000
b >= δ / 1000
δ in {0,1}
Many MIP solvers support indicator constraints. That would allow you to say:
δ = 0 -> a = 0
δ = 1 -> b >= 0.001
δ in {0,1}
Suppose we have logical image y and we want to make a copy of it. What is differences between the following statements:
x = y;
x = y==1;
x = y is an assignment. It sets the variable x to the value currently contained in variable y.
x==y is a logical operator asking "Is x equal to y"?
The statement x=y==1 sets all parts of x to true where the corresponding value of y is equal to 1.
The difference between the two statements you pose is thus that in the first statement, x=y, x becomes an exact copy of y. In the second statement however, x becomes a logical matrix with boolean values. 1 where y contains a 1 and 0 where y contains anything but 1.
In your specific case, where y already is a logical matrix (thus containing only 1 and 0) both statements are thus equivalent as per the above and then the first statement will be faster as the equality check is redundant and thus adds unnecessary overhead.
I have 2 functions declared in wxmaxima: f1(x, y) and f2(x, y). Both contain if-then-else statements and basic arithmetic operations: addition, subtraction, multiplication and division.
For example (just an example, real functions look much more complicated):
f1(x, y) := block([],
if x * y < 123 then x + y
else if x / y > 7 then x - y
);
In both functions x and y change from 0.1 to 500000.
I need a 3D plot (graph) of the following points:
(x, y, z), where f1(x, y) == f2(z, x)
Note that it's impossible to extract z out from the equation above (and get a new shiny function f3(x, y)), since f1 and f2 are too complex.
Is this something possible to achieve using any computational software?
Thanks in advance!
EDIT:
What I need is the plot for
F(x, y, z) = 0
where
F(x, y, z) = f1(x, y) - f2(z, x)
For Maxima, try implicit_plot(f1(x, y) = f2(x, y), [x, <x0>, <x1>], [y, <y0>, <y1>]) where <x0>, <x1>, <y0>, <y1> are some floating point numbers which are the range of the plot. Note that load(implicit_plot) is needed since implicit_plot is not loaded by default.
As an aside, I see that your function f1 has the form if <condition1> then ... else if <condition2> then ... and that's all. That means if both <condition1> and <condition2> are false, then the function will return false, not a number. Either you must ensure that the conditions are exhaustive, or put else ... at the end of the if so that it will return a number no matter what the input.
set = Table[{i,j,0},{i,1,10},{j,0,10}];
Gives a list of desired x and y values and use those with a replace all /.
set = set /.{a_ ,b_ ,c_} -> {a,b, f1[a,b] - f2[a,b]} (*Simplified of course*)
Set is a 2d list of lists so it needs to be flattened by 1 dimension.
set = Flatten[set,1];
ListPlot3D[set (*add plot options*)]