Problem:Compute the partial derivatives with respect to x and y for |
> f := (x,y) -> sin(sqrt(x))*log(y^2);
2
f := (x, y) -> sin(sqrt(x)) log(y )
| and evaluate them at (1,1/2). |
|
|
Answer:
| Just do it! |
| w.r.t. x is fx given by |
> fx := diff(f(x,y),x);
1/2 2
cos(x ) ln(y )
fx := 1/2 ----------------
1/2
x
| and w.r.t. y is fy given by |
> fy := diff(f(x,y),y);
1/2
sin(x )
fy := 2 ---------
y
| For the purposes of evaluation it is more convenient to use the "D" operator. Hence, the value of the partial w.r.t. x evaluated at (1,1/2) is given by, |
> D[1](f)(1.,0.5);
-.3745090200
| and fy(1,1/2) is given by, |
> Dfy := unapply(fy,(x,y));
1/2
sin(x )
Dfy := (x, y) -> 2 ---------
y
| Now apply, |
> Dfy(1.,0.5);
3.365883940