1Function: variables 2Section: conversions 3C-Name: variables_vec 4Prototype: DG 5Help: variables({x}): all variables occurring in object x, sorted by 6 decreasing priority. Returns the list of user variables if x is omitted. 7Doc: 8 returns the list of all variables occurring in object $x$ (all user 9 variables known to the interpreter if $x$ is omitted), sorted by 10 decreasing priority. 11 \bprog 12 ? variables([x^2 + y*z + O(t), a+x]) 13 %1 = [x, y, z, t, a] 14 @eprog\noindent The construction 15 \bprog 16 if (!variables(x),...) 17 @eprog\noindent can be used to test whether a variable is attached to $x$. 18 19 If \kbd{varhigher} or \kbd{varlower} are used, it is quite possible to end up 20 with different variables (with different priorities) printed in the same 21 way: they will then appear multiple times in the output: 22 \bprog 23 ? y1 = varhigher("y"); 24 ? y2 = varlower("y"); 25 ? variables(y*y1*y2) 26 %4 = [y, y, y] 27 @eprog 28 29Variant: 30 Also available is \fun{GEN}{variables_vecsmall}{GEN x} which returns 31 the (sorted) variable numbers instead of the attached monomials of degree 1. 32