Transpose of a symbolic 'real' results in conj()
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Chris B
am 11 Jul. 2018
Beantwortet: Yuichi Tadokoro
am 13 Jul. 2018
Hello,
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);
assume(c,'real')
result = c'
Result:
[ 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.
0 Kommentare
Akzeptierte Antwort
Yuichi Tadokoro
am 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')]
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Assumptions finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!