How to know which elements of a symbolic vector are real?

5 Ansichten (letzte 30 Tage)
Renzo Segovia
Renzo Segovia am 4 Nov. 2020
Beantwortet: Walter Roberson am 11 Feb. 2025
I have this sym vector:
c = -(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 1)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 1)^2 + 974025000000000)^(1/2))/26887350
(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 1)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 1)^2 + 974025000000000)^(1/2))/26887350
-(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 2)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 2)^2 + 974025000000000)^(1/2))/26887350
(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 2)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 2)^2 + 974025000000000)^(1/2))/26887350
-(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 3)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 3)^2 + 974025000000000)^(1/2))/26887350
(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 3)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 3)^2 + 974025000000000)^(1/2))/26887350
-(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 4)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 4)^2 + 974025000000000)^(1/2))/26887350
(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 4)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 4)^2 + 974025000000000)^(1/2))/26887350
-(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 5)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 5)^2 + 974025000000000)^(1/2))/26887350
(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 5)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 5)^2 + 974025000000000)^(1/2))/26887350
-(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 6)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 6)^2 + 974025000000000)^(1/2))/26887350
(179249^(1/2)*(634751*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 6)^4 - 45299238750*root(z^6 - (58169238750*z^4)/634751 + (130018668750000*z^2)/48827 - 1184625000000000000/48827, z, 6)^2 + 974025000000000)^(1/2))/26887350
Is it any easy (coded) way I can know which elements are real and which aren't?

Antworten (2)

Gautam
Gautam am 11 Feb. 2025
Hello Renzo,
To determine which elements of a symbolic vector are real, you can use the isAlways function in conjunction with the isreal condition. This approach checks whether each element of the symbolic vector is always real under all assumptions.

Walter Roberson
Walter Roberson am 11 Feb. 2025
 c(imag(c)==0)

Community Treasure Hunt

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

Start Hunting!

Translated by