# Question:Recommended way to defining functions using results from function calls such as diff ?

## Question:Recommended way to defining functions using results from function calls such as diff ?

Maple

Simple example to illustrate the desired functionality:
Say we have a 2D vector function which describes the position of a particle

`r := t -> <5*cos(Pi*t), 5*sin(Pi*t)>`

We want to define the velocity and acceleration as functions, so we could do something like

`v := t -> <diff(r(t)[1], t), diff(r(t)[2], t)>`

The problem now is that we cannot call our velocity function with numeric arguments.
A simple solution is to call the function via "subs", as in

`subs(t = 2, v(t))`

but IMHO, this is not very elegant and I guess inefficient. Is there a command that enables for pulling out the evaluated result from diff such that it can be used directly as a functional expression ? I.e., I want to be able to call

`v(2)`

directly, without having to do substitutions.

EDIT:

I found that you can do

```v := <diff(r(t)[1], t, diff(r(t)[2], t)>
v := unapply(v, t)
```