Main Content

指数函数的图形比较

此示例介绍了一种有趣的图形方法,用以确定 eπ 是否大于 πe

问题:eππe 哪一个更大?最简单的确定方法是直接通过 MATLAB® 命令提示符键入这两个值。但是,另一种分析方法是提出一个更普遍的问题:函数 z(x,y)=xy-yx 是什么形状?

下面是 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);
h.EdgeColor = [0.7 0.7 0.7];
view(20,50);
colormap(hsv);
title('$z = x^y-y^x$','Interpreter','latex')
xlabel('x')
ylabel('y')
hold on

Figure contains an axes object. The axes object with title z equals x toThePowerOf y baseline minus y toThePowerOf x baseline, xlabel x, ylabel y contains an object of type surface.

xy-yx=0 方程解的形状较为特别,单纯通过观察并不足以解决我们一开始的问题。下图是使得 z=0xy 值。

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
line(xContour,yContour,'Color','k');

Figure contains an axes object. The axes object with title z equals x toThePowerOf y baseline minus y toThePowerOf x baseline, xlabel x, ylabel y contains 2 objects of type surface, line.

黑色曲线上部分点处的 xy 同时为整数。下图是方程 xy-yx=0 的整数解。请注意,24=42xy 时的唯一整数解。

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

Figure contains an axes object. The axes object with title z equals x toThePowerOf y baseline minus y toThePowerOf x baseline, xlabel x, ylabel y contains 3 objects of type surface, line. One or more of the lines displays its values using only markers

最后,在曲面上绘制点 (π,e)(e,π)。结果显示,eπ 确实大于 πe(尽管相差不大)。

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', ...
   'HorizontalAlignment','left','VerticalAlignment','bottom');
text(3.3,e,'(pi,e)','Color','k','HorizontalAlignment','left',...
   'VerticalAlignment','bottom');
hold off;

Figure contains an axes object. The axes object with title z equals x toThePowerOf y baseline minus y toThePowerOf x baseline, xlabel x, ylabel y contains 7 objects of type surface, line, text. One or more of the lines displays its values using only markers

验证结果。

e = exp(1);
e^pi
ans = 23.1407
pi^e
ans = 22.4592

另请参阅

|