functional operators examples - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

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→sin⁡x

F:=x→sin⁡x

(1.1)
> 

F⁡t

sin⁡t

(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→x⁡t

t

(1.12)
> 

x→x24

16

(1.13)

Operators are distributive.

> 

a+b⁡t

a⁡t+b⁡t

(1.14)
> 

a+1⁡t

a⁡t+1

(1.15)

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

> 

f≔x→x+2;g≔y→y

f:=x→x+2

g:=y→y

(1.16)
> 

f@gt;g@ft

t+2

t+2

(1.17)
> 

x→sinx@x→arcsinxt

t

(1.18)

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

> 

x→ln⁡x+1@@2t

ln⁡ln⁡t+1+1

(1.19)

See Also

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

 

Return to Index for Example Worksheets