Transpose of a symbolic 'real' results in conj()

15 views (last 30 days)
I'm facing an issue where I define a symbol as real, assign an expression to it (trigonometric in this case) and transpose it. Unfortunately, the result includes conjugate elements.
Minimal example:
a = sym('a', 'real');
b = sym('b', 'real');
c = sym('c', [3,1], 'real');
c(1) = sin(a)*cos(b);
result = c'
[ cos(conj(b))*sin(conj(a)), c2, c3]
The issue does not occur with assume(c, 'real') removed. The reason why it would make sense to have it is that overwriting c with a term might remove the assumption of the former definition.
If I run "assumptions", for the case without assume(c,'real') it shows:
[ in(a, 'real'), in(b, 'real'), in(c1, 'real'), in(c2, 'real'), in(c3, 'real')]
and with assume(c,'real'):
[ in(cos(b)*sin(a), 'real'), in(c1, 'real'), in(c2, 'real'), in(c3, 'real')]
The only difference is that it now assumes the whole term c(1) = cos(b)*sin(a) to be real.
Of course, I could use the element-wise transpose:
result = c.'
This works and does not result in conjugate elements. But the overall issue I'm facing is that I depend on all functions that are used on c, would need to do element-wise transpose. I, for instance, calculate the rank of a matrix based on elements similar to c and it seems that there is one more linear dependent row than compared to other mathematical tools.
Thanks in advance.

Accepted Answer

Yuichi Tadokoro
Yuichi Tadokoro on 13 Jul 2018
You need to use
assumeAlso(c, 'real')
instead of 'assume' to keep the assumptions on a and b.
>> assumptions
ans =
[ in(cos(b)*sin(a), 'real'), in(a, 'real'), in(b, 'real'), in(c1, 'real'), in(c2, 'real'), in(c3, 'real')]

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!