# 2.6 A system of non-polynomial equations revisited

```#
# -
#
#
#                                               WORKSHEET#17
#
#                         A system of non-polynomial equations revisited
#
#
--------------------------------------------------------------------------------
# We reconsider the critical point analysis for the function f(x,y) from the last worksheet.
--------------------------------------------------------------------------------
> f:=(x,y)->sin(y-x^2-1)+cos(2*y^2-x);

2               2
f := (x,y) -> sin(y - x  - 1) + cos(2 y  - x)
--------------------------------------------------------------------------------
> f1:=D[1](f);f2:=D[2](f);

2                   2
f1 := (x,y) -> - 2 cos(- y + x  + 1) x - sin(- 2 y  + x)

2                   2
f2 := (x,y) -> cos(- y + x  + 1) + 4 sin(- 2 y  + x) y
--------------------------------------------------------------------------------
> e1:=f1(x,y)=0;e2:=f2(x,y)=0;

2                   2
e1 := - 2 cos(- y + x  + 1) x - sin(- 2 y  + x) = 0

2                   2
e2 := cos(- y + x  + 1) + 4 sin(- 2 y  + x) y = 0
--------------------------------------------------------------------------------
> e1+2*x*e2;

2                   2
- 2 cos(- y + x  + 1) x - sin(- 2 y  + x)

2                   2
+ 2 x (cos(- y + x  + 1) + 4 sin(- 2 y  + x) y) = 0
--------------------------------------------------------------------------------
> simplify(");

2                     2
- sin(- 2 y  + x) + 8 x sin(- 2 y  + x) y = 0
--------------------------------------------------------------------------------
> factor(");

2
sin(- 2 y  + x) (- 1 + 8 x y) = 0
--------------------------------------------------------------------------------
> e3:=";

2
e3 := sin(- 2 y  + x) (- 1 + 8 x y) = 0
--------------------------------------------------------------------------------
> simplify(4*y*e1+e2);

2                     2
- 8 y cos(- y + x  + 1) x + cos(- y + x  + 1) = 0
--------------------------------------------------------------------------------
> e4:=factor(");

2
e4 := - cos(- y + x  + 1) (- 1 + 8 x y) = 0
--------------------------------------------------------------------------------
# By elementary manipulation of equations we have reduced the more complicated system
# of equations e1=0, e2=0 to the much easier, but equivalent system, e3=0, e4=0.  By
# inspection we see that the solutions of this system are given by either 8xy=1 or
#
#                                        sin(-2y^2+x)=0 and cos(-y+x^2+1)=0.
#
# What does Maple say about these equations?
--------------------------------------------------------------------------------
> solve(e3,x);

2   1
2 y , ---
8 y
--------------------------------------------------------------------------------
# Maple does not give the complete solution of the equation (-1+8xy)sin(-2y^2+x)=0.  But
# we can easily see that the complete solution is either 8xy=1 or x=2y^2+mPi, where m is
# any integer.
#
# As far as e4=0 is concerned we see that the complete solution is either 8xy=1 or
#
#                                      y=x^2+1+(n+1/2)Pi, where n is an integer.
#
# Thus there are 2 types of critical points for f(x,y)=sin(y-x^2-1)+cos(2*y^2-x), namely
# those points (x,y) where either 8xy=1  or
#
#                          x=2y^2+mPi and y=x^2+1+(n+1/2)Pi for some integers m,n.
#
# Notice that if x=2y^2+mPi and y=x^2+1+(n+1/2)Pi for some integers m,n then
# f(x,y)=sin(y-x^2-1)+cos(2y^2-x)=sin((n+1/2)Pi)+cos(-mPi)=(-1)^n+(-1)^m, and this
# equals -2, +2 or 0.  Since f(x,y) assumes values between -2 and +2 we know that those
# points where f=2 are maxima and those points where f=-2 are minima.
#
--------------------------------------------------------------------------------
> subs({x-2*y^2=m*Pi,-y+x^2+1=(n+1/2)*Pi},f(x,y));

- sin((n + 1/2) Pi) + cos(m Pi)
> A:=simplify(");

A := - cos(Pi n) + cos(m Pi)
--------------------------------------------------------------------------------
> weknow:=sin(n*Pi)=0,sin(m*Pi)=0,cos(m*Pi)=(-1)^m,cos(n*Pi)=(-1)^n,\
sin((n+1/2)*Pi)=(-1)^n,cos((n+1/2)*Pi)=0;

m                  n
weknow := sin(Pi n) = 0, sin(m Pi) = 0, cos(m Pi) = (-1) , cos(Pi n) = (-1) ,

n
sin((n + 1/2) Pi) = (-1) , cos((n + 1/2) Pi) = 0
> subs(weknow,A);\

n       m
- (-1)  + (-1)
> with(linalg):
Warning: new definition for   norm
Warning: new definition for   trace

--------------------------------------------------------------------------------
> H:=hessian(f(x,y),[x,y]);

H :=               2       2                2                 2
[4 sin(- y + x  + 1) x  - 2 cos(- y + x  + 1) - cos(- 2 y  + x),

2                     2
- 2 sin(- y + x  + 1) x + 4 cos(- 2 y  + x) y]

2                     2
[- 2 sin(- y + x  + 1) x + 4 cos(- 2 y  + x) y,

2                    2       2              2
sin(- y + x  + 1) - 16 cos(- 2 y  + x) y  + 4 sin(- 2 y  + x)]
--------------------------------------------------------------------------------
#
> H;

H
--------------------------------------------------------------------------------
# This is a bit peculiar.
#
--------------------------------------------------------------------------------
> eval(H);

2       2                2                 2
[4 sin(- y + x  + 1) x  - 2 cos(- y + x  + 1) - cos(- 2 y  + x),

2                     2
- 2 sin(- y + x  + 1) x + 4 cos(- 2 y  + x) y]

2                     2
[- 2 sin(- y + x  + 1) x + 4 cos(- 2 y  + x) y,

2                    2       2              2
sin(- y + x  + 1) - 16 cos(- 2 y  + x) y  + 4 sin(- 2 y  + x)]
--------------------------------------------------------------------------------
> H[1,1];

2       2                2                 2
4 sin(- y + x  + 1) x  - 2 cos(- y + x  + 1) - cos(- 2 y  + x)
--------------------------------------------------------------------------------
> subs({x-2*y^2=m*Pi,-y+x^2+1=(n+1/2)*Pi},eval(H));

2
[4 sin((n + 1/2) Pi) x  - 2 cos((n + 1/2) Pi) - cos(m Pi),

- 2 sin((n + 1/2) Pi) x + 4 cos(m Pi) y]

[- 2 sin((n + 1/2) Pi) x + 4 cos(m Pi) y,

2
sin((n + 1/2) Pi) - 16 cos(m Pi) y  + 4 sin(m Pi)]
--------------------------------------------------------------------------------
> subs(weknow,");

[          n  2       m            n           m   ]
[    4 (-1)  x  - (-1)     - 2 (-1)  x + 4 (-1)  y ]
[                                                  ]
[         n           m          n          m  2   ]
[ - 2 (-1)  x + 4 (-1)  y    (-1)  - 16 (-1)  y    ]
--------------------------------------------------------------------------------
> det(");

n  2     m  2       m     n          n       m
- 64 (-1)  x  (-1)  y  - (-1)  (-1)  + 16 (-1)  x (-1)  y
--------------------------------------------------------------------------------
> factor(");

m     n              2
- (-1)  (-1)  (- 1 + 8 x y)
--------------------------------------------------------------------------------
# Assume that 8xy is not equal to 1.  If m and n have the same parity then the determinant
# is negative, in which case we have a saddle point.  If m and n have opposite parity then
# the critical point can be either a maximum or a minimum.  To decide which merely
# examine the [1,1] entry of the hessian.  If this is positive then both eigenvalues will be
# positive and if it is negative both eigenvalues will be negative.
--------------------------------------------------------------------------------

```