The second part of your first line of code (that I've broken in two) doesn't do what I believe you think it does.
abs(c1) >= abs(c2) >= abs(c3)
ans = This does not tell MATLAB to assume that the absolute value of c1 is greater than the absolute value of c2 which is greater than the absolute value of c3. That's what I believe you expected it to do. If you want MATLAB to make assumptions about the values of the variables, you need to call the assume and/or assumeAlso functions. assume(abs(c1) >= abs(c2))
assumeAlso(abs(c2) >= abs(c3))
assumptions
ans = a = 1/4 - c2/4 - c3/4 - c1/4;
b = c2/4 - c1/4 + c3/4 + 1/4;
c = c1/4 - c2/4 + c3/4 + 1/4;
d = c1/4 + c2/4 - c3/4 + 1/4;
A_asc = sort(A)
A_asc =
Does this match what you expected?
Obviously, this is not the answer I wanted. The answer I want is
[1/4 - c2/4 - c3/4 - c1/4
c2/4 - c1/4 + c3/4 + 1/4
c1/4 - c2/4 + c3/4 + 1/4
c1/4 + c2/4 - c3/4 + 1/4]
Yes, it looks like it is. [The order of the terms doesn't matter.]
Now for a bigger question: is your expected answer correct in all cases?
delta = A_asc(2:4)-A_asc(1:3)
delta =
If A_asc is sorted in ascending order, all the elements of A must be greater than 0. Are they? Let's substitute some sample values that satisfy your assumptions for the variables.
areAssumptionsSatisfied = [abs(C(1)) >= abs(C(2)), abs(C(2)) >= abs(C(3))]
areAssumptionsSatisfied =
1 1
subs(delta, [c1, c2, c3], C)
ans =
That says that the third element of A_asc is smaller than the second. Let's check by looking at the values in A_asc.
subs(A_asc, [c1, c2, c3], C)
ans =
The third element is indeed smaller than the second. Your expectation about the order in which those terms should be sorted is not correct. But are there parameter values that could make A_asc sorted in ascending order? Yes.
areAssumptionsSatisfied = [abs(C2(1)) >= abs(C2(2)), abs(C2(2)) >= abs(C2(3))]
areAssumptionsSatisfied =
1 1
subs(A_asc, [c1, c2, c3], C2)
ans =
Does it really make sense to ask which element of A is the largest? Sometimes that question doesn't make sense, like the simple example below.
isAlways(x > y)
Warning: Unable to prove 'y < x'.