Previous Up Next

2.16.3Defining algebraic functions

Defining a function from ℝp to ℝ

For p=1, e.g. for f : (x)→ x*sin(x), input :

f(x):=x*sin(x)

Or :

f:=x->x*sin(x)

Output :

(x)->x*sin(x)

If p>1, e.g. for f : (x,y)→ x*sin(y), input :

f(x,y):=x*sin(y)

Or :

f:=(x,y)->x*sin(y)

Output :

(x,y)->x*sin(y)

Warning !!! the expression after -> is not evaluated. You should use unapply if you expect the second member to be evaluated before the function is defined.

Defining a function from ℝp to ℝq

For example:

Warning !!! the expression after -> is not evaluated.

Defining families of function from ℝp−1 to ℝq using a function from ℝp to ℝq

Suppose that the function f: (x,y) → f(x,y) is defined, and we want to define a family of functions g(t) such that g(t)(y):=f(t,y) (i.e. t is viewed as a parameter). Since the expression after -> (or :=) is not evaluated, we should not define g(t) by g(t):=y->f(t,y), we have to use the unapply command.

For example, assuming that f:(x,y)→ xsin(y) and g(t): yf(t,y), input :

f(x,y):=x*sin(y);g(t):=unapply(f(t,y),y)

Output :

((x,y)->x*sin(y), (t)->unapply(f(t,y),y))

Input

g(2)

Output :

y->2 sin(y)

Input

g(2)(1)

Output :

2 sin(1)

Next example, suppose that the function h: (x,y) → [x*cos(y),x*sin(y)] is defined, and we want to define the family of functions k(t) having t as parameter such that k(t)(y):=h(t,y). To define the function h(x,y), input :

h(x,y):=(x*cos(y),x*sin(y))

To define properly the function k(t), input :

k(t):=unapply(h(x,t),x)

Output :

(t)->unapply(h(x,t),x)

Input

k(2)

Output :

(x)->(x*cos(2),x*sin(2))

Input

k(2)(1)

Output :

(2*cos(1),2*sin(1))

Previous Up Next