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

2 visualizaciones (últimos 30 días)
Renzo Segovia
Renzo Segovia el 4 de Nov. de 2020
Respondida: Walter Roberson el 11 de Feb. de 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?

Respuestas (2)

Gautam
Gautam el 11 de Feb. de 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 el 11 de Feb. de 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