functional operators examples - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Operations : Operators : functional operators examples

Examples of Functional Operators

A functional operator in Maple is a special form of a procedure. Functional operators are written using arrow notation:

  vars  result

For basic information, see Functional Operators.  The following examples demonstrate the different types of functional operators that you can use in Maple.

Examples

First, define a basic operator on a single variable x and apply it using function notation.

F:=x→sinx

F:=x→sinx

(1.1)

Ft

sint

(1.2)

In this example, empty parentheses denote that the operator returns 1, no matter what the input.

A:=→1

A:=→1

(1.3)

Ax

1

(1.4)

Note that in 1-D Math input, an operator can always be applied by using function notation.  However, in 2-D Math input, when the operator is also of type atomic, you must use the apply command.  This is because 1x is interpreted as multiplication in 2-D math rather than function application.  For more information, including how to change this default behavior, see 2DMathDetails.  

1(x);

1

(1.5)

1x

x

(1.6)

apply1, x

1

(1.7)

Similarly, this multivariate operator returns 3.14, no matter what the input.

B:=→3.14

B:=→3.14

(1.8)

Bx,y

3.14

(1.9)

3.14(x,y);

3.14

(1.10)

apply3.14, x,y

3.14

(1.11)

Operators can be applied without assigning them a name.

x→xt

t

(1.12)

xx24

16

(1.13)

Operators are distributive.

a+bt

at+bt

(1.14)

a+1t

at+1

(1.15)

Use the composition operator @ to perform operator composition.  That is, f@g means fg.

fxx+2;gyy

f:=x→x+2

g:=y→y

(1.16)

f@gt;g@ft

t+2

t+2

(1.17)

xsinx@xarcsinxt

t

(1.18)

Repeated composition is entered with the @@ operator.  Here, a function is composed with itself.

x→lnx+1@@2t

lnlnt+1+1

(1.19)

See Also

@, @@, 2-D Math Details, apply, D, Functional Operators, unapply  

 

Return to Index for Example Worksheets


Download Help Document