Previous Up Next

6.18.3  Définition d’une fonction

Définition d’une fonction de ℝp dans ℝ

On tape pour définir la fonction f : (x)−>x*sin(x) :

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

Ou on tape :

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

On obtient :

(x)->x*sin(x)

On tape pour définir la fonction f : (x,y)−>x*sin(y) :

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

Ou on tape :

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

On obtient :

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

Attention !!! ce qui se trouve après -> n’est pas évalué.

Définition d’une fonction de ℝp dans ℝq

On tape pour définir la fonction h : (x,y)−>(x*cos(y),x*sin(y)) :

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

On tape pour définir la fonction h : (x,y)−>[x*cos(y),x*sin(y)] :

h(x,y):=[x*cos(y),x*sin(y)];

Ou on tape :

h:=(x,y)->[x*cos(y),x*sin(y)];

Ou on tape :

h(x,y):={[x*cos(y),x*sin(y)]};

Ou on tape :

h:=(x,y)->return[x*cos(y),x*sin(y)];

Ou on tape

h(x,y):={return [x*cos(y),x*sin(y)];}

On obtient :

(x,y)->{return([x*cos(y),x*sin(y)]);}

Attention !!! ce qui se trouve après -> n’est pas évalué.

Définition d’une fonction de ℝp−1 dans ℝq à partir d’une fonction de ℝp dans ℝq

On définit la fonction f(x,y)=x*sin(y), puis on veut définir la famille de fonctions dépendant du paramètre t par g(t)(y):=f(t,y).
Comme ce qui se trouve après -> n’est pas évalué, on ne peut pas définir g(t) par g(t):=y->f(t,y) et on doit utiliser la commande unapply.
On tape pour définir les fonctions f(x,y)=xsin(y) et g(t)=y−>f(t,y) :

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

On obtient :

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

On tape

g(2)

On obtient :

y->2· sin(y)

On tape

g(2)(1)

On obtient :

2· sin(1)

On définit la fonction h(x,y)=(x*cos(y),x*sin(y)), puis on veut définir la famille de fonctions dépendant du paramètre t par k(t)(y):=h(t,y).
Comme ce qui se trouve après -> n’est pas évalué, on ne peut pas définir k(t) par k(t):=y−>h(x,y) et on est obligé d’utiliser la commande unapply.
On tape pour définir la fonction h(x,y) :

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

On tape pour définir la fonction k(t) :

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

On obtient :

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

On tape

k(2)

On obtient :

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

On tape

k(2)(1)

On obtient :

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

Ou encore On définit la fonction h(x,y)=[x*cos(y),x*sin(y)], puis on veut définir la famille de fonctions dépendant du paramètre t par k(t)(y):=h(t,y).
Comme ce qui se trouve après -> n’est pas évalué, on ne peut pas définir k(t) par k(t):=y−>h(x,y) et on est obligé d’utiliser la commande unapply.
On tape pour définir la fonction h(x,y) :

h(x,y):={[x*cos(y),x*sin(y)]}

On tape pour définir la fonction k(t) :

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

On obtient :

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

On tape

k(2)

On obtient :

(x)->{[x*cos(2),x*sin(2)];}

On tape

k(2)(1)

On obtient :

[2· cos(1),2· sin(1)]

Previous Up Next