라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.

Graphical Approach to Solving Inequalities

This example shows an interesting graphical approach to find out whether e^pi is greater than pi^e or not.

The question is: which is greater, e^pi or pi^e? The easy way to find out is to type it directly at the MATLAB® command prompt. But it motivates a more interesting question. What is the shape of the function z = x^y-y^x? Here is a plot of z.

% Define the mesh
x = 0:0.16:5;
y = 0:0.16:5;
[xx,yy] = meshgrid(x,y);

% The plot
zz = xx.^yy-yy.^xx;
h = surf(x,y,zz);

% Set the properties of the plot
h.EdgeColor = [0.7 0.7 0.7];
title('z = x^y-y^x');
hold on;

It turns out that the solution of the equation x^y-y^x = 0 has a very interesting shape. Because interesting things happen near e and pi, our original question is not easily solved by inspection. Here is a plot of that equation shown in black.

c = contourc(x,y,zz,[0 0]);
list1Len = c(2,1);
xContour = [c(1,2:1+list1Len) NaN c(1,3+list1Len:size(c,2))];
yContour = [c(2,2:1+list1Len) NaN c(2,3+list1Len:size(c,2))];
% Note that the NAN above prevents the end of the first contour line from being
% connected to the beginning of the second line

Here is a plot of the integer solutions to the equation x^y-y^x = 0. Notice 2^4 = 4^2 is the ONLY integer solution where x ~= y. So, what is the intersection point of the two curves that define where x^y = y^x?

plot([0:5 2 4],[0:5 4 2],'r.','MarkerSize',25);

Finally, we can see that e^pi is indeed larger than pi^e (though not by much) by plotting these points on our surface.

e = exp(1);
plot([e pi],[pi e],'r.','MarkerSize',25);
plot([e pi],[pi e],'y.','MarkerSize',10);
text(e,3.3,'(e,pi)','Color','k', ...
hold off;

Here is a verification of this fact.

e = exp(1);
ans =


ans =


Was this topic helpful?