감동, 마음이 움직이는 것

[mathematica] list of symbolic variables and check the positive or negative in the list values 본문

Tips (Utility, Computer Language, and etc.)

[mathematica] list of symbolic variables and check the positive or negative in the list values

Struggler J. 2021. 6. 1. 21:19

1. making a list of symbolic variables 

in[1]= var = x/@Range[4]
out[1]= {x[1], x[2], x[3], x[4]}

2. checking positive or negative values in the list 

in[1]= 	vec = {1, 2, Sqrt[3], 4}
		VectorQ[Re[vec], Negative]
		VectorQ[Re[vec], Positive]
out[1]= {1,2,3+i,4}
out[2]= False
out[3]= True