### The Maxima on-line user's manual

Algebra Calculator

#### Op

Function: op (<expr>) Returns the main operator of the expression <expr>. `op (<expr>)` is equivalent to `part (<expr>, 0)`.

`op` returns a string if the main operator is a built-in or user-defined prefix, binary or n-ary infix, postfix, matchfix, or nofix operator. Otherwise, if <expr> is a subscripted function expression, `op` returns the subscripted function; in this case the return value is not an atom. Otherwise, <expr> is an array function or ordinary function expression, and `op` returns a symbol.

`op` observes the value of the global flag `inflag`.

`op` evaluates it argument.

See also `args`.

Examples:

```          (%i1) stringdisp: true\$
(%i2) op (a * b * c);
(%o2)                          "*"
(%i3) op (a * b + c);
(%o3)                          "+"
(%i4) op (sin (a + b));
(%o4)                          sin
(%i5) op (a!);
(%o5)                          "!"
(%i6) op (-a);
(%o6)                          "-"
(%i7) op ([a, b, c]);
(%o7)                          "["
(%i8) op ((if a > b then c else d));
(%o8)                         "if"
(%i9) op (foo (a));
(%o9)                          foo
(%i10) prefix (foo);
(%o10)                        "foo"
(%i11) op (foo a);
(%o11)                        "foo"
(%i12) op (F [x, y] (a, b, c));
(%o12)                        F
x, y
(%i13) op (G [u, v, w]);
(%o13)                          G```

There are also some inexact matches for `op`. Try `?? op` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

u00: df_u[0,0];

op(u00);

Calculate

##### op-part-sum

s: sum(a[i]*sum(b[i,j...

part(s,0);

part(s,1);

Calculate

##### op-part

u:(6*x+7)/(9*x+2);

part(u,1);

op(part(u,1));

Calculate

##### op-sqrt

pe(x1,y1,z1,x2,y2,z2)...

modulo(x,y,z):=sqrt(p...

uv:pe(2,1,0,3,-1,2);

Calculate

##### op

op(foo(p,q));

foo;

op(foo( p, q ) := p -...

Calculate

##### op-prefix-sin-stringdisp-true

stringdisp: true;

op (a * b * c);

op (a * b + c);

Calculate

##### op-part

u:(6*x+7)/(9*x+2);

part(u,1);

op(part(u,1));

Calculate

op(a+b);

op(a*b);

op(a^b);

Calculate

##### op-part-sum

s: sum(a[i]*sum(b[i,j...

part(s,0);

part(s,1);

Calculate

op(x+2);

Calculate