# Question:Explain how maple handles functions

## Question:Explain how maple handles functions

Maple

I know how to define functions and generally how to pass them to another function and usually everything works out... rarely though I run in to problems and my lack of how maple works internally becomes a stumbling block. I usually just hack things together. I'd rather understand what exactly is happening.

It seems that apply and unapply have something to do with this.

I usually define functions like this, e.g.,

f := x->x^2 + 3;

g := (f,x)->cos(f(x));

and things like g(f,x) work as expected.

But this doesn't always work.

E := proc(f, depth)
if depth <= 0 then return f; fi:
E(f(x), depth-1); # Trying to actually compute f(f(x)), say. I know we can just loop.
end proc:

E(x->2*x, 3);

2*x(x)(x)

rather than 8x

I see that maple is somehow applying the function but in some odd way(it seems to be creating a function from the variable x and then another function from that).

Anyways, I don't understand the mechanics of it. In some cases f works other one must add the variablef(x), etc...

There seems to be some subtle difference between f and f(x)...  In a programing language like C. f is sort of a function pointer and f(x) is an evaluation of f at x. I guess there is something similar goingn on with maple but i've not been able to figure it out. Any ideas?

﻿