Linear and Quadratic Approximations in Maple 

Math 2130 Spring 2011 

 

This worksheet contains code for several functions which compute 

multivariate Taylor polynomials. Alternatively you can just use the  

built in command "TaylorApproximation" (shown below).
Maple worksheet:
math2130-spring2011-quadratic_approximations.mw

Below the code are the solutions for (most of) the problems found
 

in our "Quadratic Approximations" supplement. 

 

"Edit → Execute → Worksheet" to make Maple show the command outputs. 

 

> restart;
with(VectorCalculus):

evalSF := proc(f,X,A)
  # Computes f with X = A (a scalar valued function version of evalVF).
  subs([seq(convert(X,list)[i]=convert(A,list)[i],i=1..nops(convert(X,list)))],f);
end proc:

LinearApproximation := proc(f,X,A)
  # Computes the linear approximation (1st order Taylor polynomial)
  # of f based at X = A.
  #
  # f is an expression (not a function) with variables X.
  # X is a vector which lists the variables on which f depends.
  # A is a vector.

  local f_A, delf_A;

  # computes f(A)
  f_A := evalSF(f,X,A);  

  # the gradient of f evaluated at X = A.
  delf_A := evalVF(Gradient(f,convert(X,list)),A);

  # Return the Linear Approximation of f at X = A.
  simplify(f_A + delf_A.(X-A));
end proc:

QuadraticApproximation := proc(f,X,A)
  # Computes the quadratic approximation (2nd order Taylor polynomial)
  # of f based at X = A.
  #
  # f is an expression (not a function) with variables X.
  # X is a vector which lists the variables on which f depends.
  # A is a vector.

  local f_A, delf_A, Hf_A;

  # computes f(A)
  f_A := evalSF(f,X,A);  

  # the gradient of f evaluated at X = A.
  delf_A := evalVF(Gradient(f,convert(X,list)),A);

  # the Hessian of f evaluated at X = A.
  Hf_A := evalSF(Hessian(f,convert(X,list)),X,A);

  # Return the Quadratic Approximation of f at X = A.
  simplify(f_A + delf_A.(X-A)+((1/2)*LinearAlgebra[Transpose](convert(X-A,Matrix)).Hf_A.convert(X-A,Matrix))[1,1]);
end proc:
 

 

Exercise #1:  f(x, y) = exp(VectorCalculus:-`+`(x, VectorCalculus:-`*`(2, y))) at (a, b) = (0, 0) 

 

> X := <x,y>;
A := <0,0>;
f := exp(x+2*y);

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078108598390)
Vector[column](%id = 18446744078108598630)
exp(`+`(x, `*`(2, `*`(y))))
`+`(1, x, `*`(2, `*`(y)))
`+`(1, x, `*`(2, `*`(y)), `*`(`/`(1, 2), `*`(`^`(x, 2))), `*`(2, `*`(x, `*`(y))), `*`(2, `*`(`^`(y, 2))))
Matrix(%id = 18446744078121081302) (1)
 

 

Exercise #2:  f(x, y) = VectorCalculus:-`+`(`*`(`^`(x, 2)), `*`(`^`(xy, 2))) at (a, b) = (2, 3) 

 

> X := <x,y>;
A := <2,3>;
f := x^2+x*y^2;

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078121081422)
Vector[column](%id = 18446744078121081542)
`+`(`*`(`^`(x, 2)), `*`(x, `*`(`^`(y, 2))))
`+`(`-`(40), `*`(13, `*`(x)), `*`(12, `*`(y)))
`+`(18, `-`(`*`(9, `*`(x))), `-`(`*`(12, `*`(y))), `*`(`^`(x, 2)), `*`(6, `*`(x, `*`(y))), `*`(2, `*`(`^`(y, 2))))
Matrix(%id = 18446744078121070094) (2)
 

 

Exercise #3:  f(x, y) = VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(`*`(`^`(x, 4)), `*`(`^`(y, 2))), xy), VectorCalculus:-`-`(VectorCalculus:-`*`(2, y))) at (a, b) = (-1, 0) 

 

> X := <x,y>;
A := <-1,0>;
f := x^4*y^2+x*y-2*y;

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078121070214)
Vector[column](%id = 18446744078121070334)
`+`(`*`(`^`(x, 4), `*`(`^`(y, 2))), `*`(x, `*`(y)), `-`(`*`(2, `*`(y))))
`+`(`-`(`*`(3, `*`(y))))
`+`(`-`(`*`(2, `*`(y))), `*`(x, `*`(y)), `*`(`^`(y, 2)))
Matrix(%id = 18446744078121050710) (3)
 

 

Exercise #4:  f(x, y) = VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(2, `*`(`^`(x, 2))), VectorCalculus:-`*`(3, `*`(`^`(y, 4)))), exp(`*`(`^`(xy, 2)))) at (a, b) = (2, 0) 

 

> X := <x,y>;
A := <2,0>;
f := 2*x^2+3*y^4+exp(x*y^2);

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078121050830)
Vector[column](%id = 18446744078121050950)
`+`(`*`(2, `*`(`^`(x, 2))), `*`(3, `*`(`^`(y, 4))), exp(`*`(x, `*`(`^`(y, 2)))))
`+`(`-`(7), `*`(8, `*`(x)))
`+`(1, `*`(2, `*`(`^`(x, 2))), `*`(2, `*`(`^`(y, 2))))
Matrix(%id = 18446744078121039982) (4)
 

 

Exercise #5:  f(x, y) = sin(xy) at (a, b) = (3, Pi) 

 

> X := <x,y>;
A := <3,Pi>;
f := sin(x*y);

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078121040102)
Vector[column](%id = 18446744078121040222)
sin(`*`(x, `*`(y)))
`+`(`-`(`*`(Pi, `*`(x))), `*`(6, `*`(Pi)), `-`(`*`(3, `*`(y))))
`+`(`*`(3, `*`(Pi)), `-`(`*`(x, `*`(y))))
Matrix(%id = 18446744078121029254) (5)
 

 

Exercise #6:  f(x, y) = ln(VectorCalculus:-`+`(`*`(`^`(x, 2)), y)) at (a, b) = (1, 0) 

 

> X := <x,y>;
A := <1,0>;
f := ln(x^2+y);

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078121029374)
Vector[column](%id = 18446744078121029494)
ln(`+`(`*`(`^`(x, 2)), y))
`+`(`*`(2, `*`(x)), `-`(2), y)
`+`(`-`(3), `*`(4, `*`(x)), `*`(3, `*`(y)), `-`(`*`(`^`(x, 2))), `-`(`*`(2, `*`(x, `*`(y)))), `-`(`*`(`/`(1, 2), `*`(`^`(y, 2)))))
Matrix(%id = 18446744078113977758) (6)
 

 

Exercise #7:  f(x, y) = cos(xy) at (a, b) = (sqrt(Pi), sqrt(Pi)) 

 

> X := <x,y>;
A := <sqrt(Pi),sqrt(Pi)>;
f := cos(x*y);

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078113977878)
Vector[column](%id = 18446744078113977998)
cos(`*`(x, `*`(y)))
-1
`+`(`-`(1), `*`(`/`(1, 2), `*`(Pi, `*`(`^`(x, 2)))), `-`(`*`(2, `*`(`^`(Pi, `/`(3, 2)), `*`(x)))), `*`(2, `*`(`^`(Pi, 2))), `*`(Pi, `*`(y, `*`(x))), `-`(`*`(2, `*`(`^`(Pi, `/`(3, 2)), `*`(y)))), `*`(`...
Matrix(%id = 18446744078113960534) (7)
 

 

Exercise #8:  f(x, y, z) = xyz at (a, b, c) = (1, 2, 3) 

 

> X := <x,y,z>;
A := <1,2,3>;
f := x*y*z;

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078113960654)
Vector[column](%id = 18446744078113960774)
`*`(x, `*`(y, `*`(z)))
`+`(`-`(12), `*`(6, `*`(x)), `*`(3, `*`(y)), `*`(2, `*`(z)))
`+`(6, `-`(`*`(6, `*`(x))), `-`(`*`(3, `*`(y))), `-`(`*`(2, `*`(z))), `*`(3, `*`(x, `*`(y))), `*`(2, `*`(x, `*`(z))), `*`(y, `*`(z)))
Matrix(%id = 18446744078113950286) (8)
 

 

Exercise #9:  f(x, y, z) = VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(x, 4)), `*`(`^`(y, 4))), `*`(`^`(z, 4))) at (a, b, c) = (-1, 0, 1) 

 

> X := <x,y,z>;
A := <-1,0,1>;
f := x^4+y^4+z^4;

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078113950406)
Vector[column](%id = 18446744078113950526)
`+`(`*`(`^`(x, 4)), `*`(`^`(y, 4)), `*`(`^`(z, 4)))
`+`(`-`(6), `-`(`*`(4, `*`(x))), `*`(4, `*`(z)))
`+`(6, `*`(8, `*`(x)), `-`(`*`(8, `*`(z))), `*`(6, `*`(`^`(x, 2))), `*`(6, `*`(`^`(z, 2))))
Matrix(%id = 18446744078113931622) (9)
 

 

Exercise #10:  f(x, y, z) = VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(`*`(`^`(x, 2)), z), `*`(`^`(xy, 2))), VectorCalculus:-`*`(`*`(`^`(y, 3)), `*`(`^`(z, 2)))), exp(VectorCalcu... at (a, b, c) = (2, 1, -2) 

 

> X := <x,y,z>;
A := <2,1,-2>;
f := x^2*z+x*y^2+y^3*z^2+exp(x*y+z);

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078113931742)
Vector[column](%id = 18446744078113931862)
`+`(`*`(`^`(x, 2), `*`(z)), `*`(x, `*`(`^`(y, 2))), `*`(`^`(y, 3), `*`(`^`(z, 2))), exp(`+`(`*`(x, `*`(y)), z)))
`+`(`-`(5), `-`(`*`(6, `*`(x))), `*`(18, `*`(y)), z)
`+`(21, `*`(5, `*`(x)), `-`(`*`(44, `*`(y))), `*`(7, `*`(z)), `*`(16, `*`(`^`(y, 2))), `-`(`*`(`/`(3, 2), `*`(`^`(x, 2)))), `*`(5, `*`(x, `*`(y))), `*`(`/`(3, 2), `*`(`^`(z, 2))), `-`(`*`(10, `*`(y, `...
Matrix(%id = 18446744078125914462) (10)
 

 

Exercise #11:  f(w, x, y, z) = VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(w, `*`(`^`(x, 2))), `*`(`^`(y, 3))), `*`(`^`(z, 4))), VectorCalculus:-`*`(`*`(`^`(w, 2)), cos(`*`(`^`(xy... at (a, b, c, d) = (0, 0, 0, 0) 

 

> X := <w,x,y,z>;
A := <0,0,0,0>;
f := w+x^2+y^3+z^4+w^2*cos(x*y^2);

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078125914582)
Vector[column](%id = 18446744078125914702)
`+`(w, `*`(`^`(x, 2)), `*`(`^`(y, 3)), `*`(`^`(z, 4)), `*`(`^`(w, 2), `*`(cos(`*`(x, `*`(`^`(y, 2)))))))
w
`+`(w, `*`(`^`(w, 2)), `*`(`^`(x, 2)))
Matrix(%id = 18446744078125896758)
Matrix(%id = 18446744078125896758)
Matrix(%id = 18446744078125896758)
Matrix(%id = 18446744078125896758)
Matrix(%id = 18446744078125896758)
(11)
 

 

Exercise #12: Let  f(x, y) = VectorCalculus:-`+`(VectorCalculus:-`+`(Ax, By), C) have linear and quadratic approximations  

                     (based at (x, y) = (a, b)) called L(x, y) and Q(x, y). Show that in 

                     this case `and`(f(x, y) = L(x, y), L(x, y) = Q(x, y)). What can be said when  

                     f(x, y) = VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`(Ax, 2)), `*`(`^`(By, 2))), Cxy), Dx), Ey), F) ? 

 

A linear approximation of a linear function is just the function itself and since the  

linear approximation is already perfect, the quadratic approximation will be no 

different. Now if f(x, y) is a quadratic function, we can expect (and in fact prove) 

that f(x, y) = Q(x, y) although it probably won't match its linear approximation 

anymore. 

 

> X := <x,y>;
A := <a,b>;

# I'm avoiding the name "A" which is already in use.
f := cA*x+cB*y+cC;

L := LinearApproximation(f,X,A);
Q := QuadraticApproximation(f,X,A);
H := Hessian(f,convert(X,list));
 

 

 

 

 

 

Vector[column](%id = 18446744078125896878)
Vector[column](%id = 18446744078125896998)
`+`(`*`(cA, `*`(x)), `*`(cB, `*`(y)), cC)
`+`(`*`(cA, `*`(x)), `*`(cB, `*`(y)), cC)
`+`(`*`(cA, `*`(x)), `*`(cB, `*`(y)), cC)
Matrix(%id = 18446744078125884110) (12)
 

 

Exercise #13: Write down the `^`(3, rd)-order terms for the Taylor polynomial expansion  

                     of f(x, y, z) at (x, y, z) = (a, b, c). 

 

VectorCalculus:-`*`(`/`(1, `*`(factorial(3))), VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculu...
VectorCalculus:-`*`(`/`(1, `*`(factorial(3))), VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculu...
VectorCalculus:-`*`(`/`(1, `*`(factorial(3))), VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculu...
 

 

Exercise #14: Write down the 4-order terms for the Taylor polynomial expansion  

                     of f(x, y) at (x, y) = (a, b). 

 

VectorCalculus:-`*`(`/`(1, `*`(factorial(4))), VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`((f[xxxx](a, b))(VectorCalculus:-`+`(x, VectorCalculus:-`-`(a))), ...
VectorCalculus:-`*`(`/`(1, `*`(factorial(4))), VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(`*`(`^`((f[xxxx](a, b))(VectorCalculus:-`+`(x, VectorCalculus:-`-`(a))), ...
 

 

I'm not sure why, but... 

 

Here is exercise #5 reworked without using any fancy commands (minus printing 

our the Hessian). Each partial is computed and then evaluated at the point (just like  

we'd do by hand). 

 

> f := (x,y) -> sin(x*y);
'f(x,y)' = f(x,y);
a := 3;
b := Pi;
 

 

 

 

proc (x, y) options operator, arrow; sin(VectorCalculus:-`*`(x, y)) end proc
f(x, y) = sin(`*`(x, `*`(y)))
3
Pi (13)
 

> fx := diff(f(x,y),x);
fy := diff(f(x,y),y);
fxx := diff(f(x,y),x,x);
fxy := diff(f(x,y),x,y);
fyy := diff(f(x,y),y,y);
fxS := simplify(subs(x=a,y=b,fx));
fyS := simplify(subs(x=a,y=b,fy));
fxxS := simplify(subs(x=a,y=b,fxx));
fxyS := simplify(subs(x=a,y=b,fxy));
fyyS := simplify(subs(x=a,y=b,fyy));
L := simplify(f(a,b) + fxS*(x-a) + fyS*(y-b));
Q := simplify(L + (1/2)*(fxxS*(x-a)^2+2*fxyS*(x-a)*(y-b)+fyyS*(y-b)^2));
 

 

 

 

 

 

 

 

 

 

 

 

`*`(cos(`*`(x, `*`(y))), `*`(y))
`*`(cos(`*`(x, `*`(y))), `*`(x))
`+`(`-`(`*`(sin(`*`(x, `*`(y))), `*`(`^`(y, 2)))))
`+`(`-`(`*`(sin(`*`(x, `*`(y))), `*`(x, `*`(y)))), cos(`*`(x, `*`(y))))
`+`(`-`(`*`(sin(`*`(x, `*`(y))), `*`(`^`(x, 2)))))
`+`(`-`(Pi))
-3
0
-1
0
`+`(`-`(`*`(Pi, `*`(x))), `*`(6, `*`(Pi)), `-`(`*`(3, `*`(y))))
`+`(`*`(3, `*`(Pi)), `-`(`*`(x, `*`(y)))) (14)
 

 

Maple has a nice built in command to compute multivariate Taylor polynomials.
So my "LinearApproximation" and "QuadraticApproximation" functions aren't
 

needed. We can just compute the Taylor polynomials of orders 1 and 2. 

 

Let's redo exercise #5 (yet again and again no Hessian) using the  

"TaylorApproximation" command. 

 

> with(Student[MultivariateCalculus]):
 

> simplify(TaylorApproximation(sin(x*y),[x,y]=[3,Pi],1));
simplify(TaylorApproximation(sin(x*y),[x,y]=[3,Pi],2));
 

 

`+`(`-`(`*`(Pi, `*`(x))), `*`(6, `*`(Pi)), `-`(`*`(3, `*`(y))))
`+`(`*`(3, `*`(Pi)), `-`(`*`(x, `*`(y)))) (15)
 

 

Now we can also compute 3rd, 4th, ... order Taylor polynomials as well. 

 

Here are the 3rd, 4th, and 5th order Taylor polynomials (continuing our previous 

example). 

 

> simplify(TaylorApproximation(sin(x*y),[x,y]=[3,Pi],3));
simplify(TaylorApproximation(sin(x*y),[x,y]=[3,Pi],4));
simplify(TaylorApproximation(sin(x*y),[x,y]=[3,Pi],5));
 

 

 

`+`(`*`(3, `*`(Pi)), `*`(`/`(9, 2), `*`(`^`(y, 3))), `-`(`*`(x, `*`(y))), `-`(`*`(36, `*`(`^`(Pi, 3)))), `*`(54, `*`(y, `*`(`^`(Pi, 2)))), `-`(`*`(27, `*`(Pi, `*`(`^`(y, 2))))), `*`(`/`(1, 6), `*`(`^`...
`+`(`*`(3, `*`(Pi)), `*`(`/`(9, 2), `*`(`^`(y, 3))), `-`(`*`(x, `*`(y))), `-`(`*`(36, `*`(`^`(Pi, 3)))), `*`(54, `*`(y, `*`(`^`(Pi, 2)))), `-`(`*`(27, `*`(Pi, `*`(`^`(y, 2))))), `*`(`/`(1, 6), `*`(`^`...
`+`(`*`(3, `*`(Pi)), `-`(`*`(9, `*`(`^`(y, 3)))), `-`(`*`(x, `*`(y))), `*`(18, `*`(`^`(Pi, 3))), `-`(`*`(54, `*`(y, `*`(`^`(Pi, 2))))), `*`(`/`(81, 2), `*`(Pi, `*`(`^`(y, 2)))), `*`(`/`(9, 2), `*`(`^`...
`+`(`*`(3, `*`(Pi)), `-`(`*`(9, `*`(`^`(y, 3)))), `-`(`*`(x, `*`(y))), `*`(18, `*`(`^`(Pi, 3))), `-`(`*`(54, `*`(y, `*`(`^`(Pi, 2))))), `*`(`/`(81, 2), `*`(Pi, `*`(`^`(y, 2)))), `*`(`/`(9, 2), `*`(`^`...
`+`(`*`(3, `*`(Pi)), `*`(`/`(9, 2), `*`(`^`(y, 3))), `-`(`*`(x, `*`(y))), `-`(`*`(9, `*`(`^`(Pi, 3)))), `*`(`/`(27, 2), `*`(y, `*`(`^`(Pi, 2)))), `*`(`/`(1, 6), `*`(`^`(Pi, 3), `*`(`^`(x, 3)))), `-`(`...
`+`(`*`(3, `*`(Pi)), `*`(`/`(9, 2), `*`(`^`(y, 3))), `-`(`*`(x, `*`(y))), `-`(`*`(9, `*`(`^`(Pi, 3)))), `*`(`/`(27, 2), `*`(y, `*`(`^`(Pi, 2)))), `*`(`/`(1, 6), `*`(`^`(Pi, 3), `*`(`^`(x, 3)))), `-`(`...
`+`(`*`(3, `*`(Pi)), `*`(`/`(9, 2), `*`(`^`(y, 3))), `-`(`*`(x, `*`(y))), `-`(`*`(9, `*`(`^`(Pi, 3)))), `*`(`/`(27, 2), `*`(y, `*`(`^`(Pi, 2)))), `*`(`/`(1, 6), `*`(`^`(Pi, 3), `*`(`^`(x, 3)))), `-`(`...
`+`(`*`(3, `*`(Pi)), `*`(`/`(9, 2), `*`(`^`(y, 3))), `-`(`*`(x, `*`(y))), `-`(`*`(9, `*`(`^`(Pi, 3)))), `*`(`/`(27, 2), `*`(y, `*`(`^`(Pi, 2)))), `*`(`/`(1, 6), `*`(`^`(Pi, 3), `*`(`^`(x, 3)))), `-`(`...
`+`(`*`(3, `*`(Pi)), `*`(`/`(9, 2), `*`(`^`(y, 3))), `-`(`*`(x, `*`(y))), `-`(`*`(9, `*`(`^`(Pi, 3)))), `*`(`/`(27, 2), `*`(y, `*`(`^`(Pi, 2)))), `*`(`/`(1, 6), `*`(`^`(Pi, 3), `*`(`^`(x, 3)))), `-`(`...
(16)
 

 

This command can also produce plots and animations. Although, you need to fight with them 

a bit to get them to show what you want. 

 

> TaylorApproximation(sin(x*y),[x,y]=[3,Pi],2,x=2.2..3.8,y=2.3..3.9,output=plot);
 

Plot_2d
 

> TaylorApproximation(sin(x*y),[x,y]=[3,Pi],10,output=animation);
 

Plot_2d