#### 6.56 arguments of a function, op function (19.9.00)

##### 6.56.1 Tom Lovie

I wanted to know if there is a function that will return the argument to a RootOf function. Like an inverse RootOf function.

Example:

G := Q=RootOf(_Z^2+4*_Z+5);

G := Q=RootOf(_Z^2+4*_Z+5)

rhs(G);
RootOf(_Z^2+4*_Z+5)



now, I’d like to get at the quantity _Z^2+4*_Z+5 so I could pass it to a discrim function.

##### 6.56.2 Paul Goossens (20.9.00)

Try

op(1,RootOf(_Z^2+4*_Z+5));



##### 6.56.3 Kevin Ulmes (20.9.00)

You could try the op function, to break down the root of function. The op function breaks down larger complex expressions into components, so used in this case, it would look something like this:

G := Q=RootOf(_Z^2+4*_Z+5);

2
G := Q = RootOf(_Z  + 4 _Z + 5)

op(rhs(G));

2
_Z  + 4 _Z + 5



You can assign that last result to a variable and pass it to the discrim function, or to any other function that you want.

##### 6.56.4 Robert Israel (20.9.00)

op(%);

or, for other forms of RootOf,

op(1,%);

##### 6.56.5 Douglas Wilhelm Harder (20.9.00)

In this case, op( * ) will work, but if something has multiple arguments, you can use op( N, * ) to select the Nth operand:

> op( f( a, b, c ) );
a, b, c

> op( 1, f( a, b, c ) );
a

> op( 2, f( a, b, c ) );
b

> A := RootOf( _Z^2+4*_Z+5 ):
> op( 1, A );
2
_Z  + 4 _Z + 5



although it is probably a good idea to change the _Z to some other variable as _Z is recognized as being special in a number of cases in Maple:

> eval( op( 1, A ), _Z = x );
2
x  + 4 x + 5



You could always just enter the routine:

> ExtractRootOf := proc(A::specfunc(anything,RootOf), y::algebraic)
eval( op( 1, A ), _Z = y );
end:

> ExtractRootOf( RootOf( _Z^2+4*_Z+5 ), x );

2
x  + 4 x + 5

> ExtractRootOf( RootOf( _Z^2+4*_Z+5 ), x^2 );

4      2
x  + 4 x  + 5



to do this for you automatically.