我想将正切的反三角函数添加到渐近线的代码中。谢谢您的建议。
settings.outformat="pdf";
unitsize(2.5cm);
import graph;
real xmin = -pi/2;
real xmax = pi/2;
real ymin = -pi/2;
real ymax = pi/2;
xlimits(xmin,xmax);
ylimits(ymin,ymax);
//axis and the grid :
xaxis(Label("$x$",align=2E),Ticks("$%.2f$",new real[]{xmin,-1,1,xmax},Size=1mm,1bp),Arrow);
yaxis(Label("$y$",align=2N),Ticks("$%.2f$",new real[]{xmin,-1,1,xmax},Size=1mm,1bp),Arrow);
// function y=sin(x)
real f(real x) {return sin(x)/cos(x); }
path g = graph(f,xmin+0.5, xmax-0.5);
draw(g,red,
L= Label("$y=tan(x)$", UnFill,
position=EndPoint));
// function y=x
draw((xmin-0.25,ymin-0.25)--(xmax+0.25,ymax+0.25),
L= Label("$y=x$", UnFill,position=EndPoint));
答案1
绘制逆图像的一般思路是以(f(x),x)
某种方式进行绘制。使用图像的余切,这意味着将代码更改为
real xmin = 0;
real xmax = pi;
real ymin = -pi/2;
real ymax = pi/2;
...
real f(real x) {return cos(x)/sin(x); }
然后在最后添加:
pair h(real t) { return (f(t),t); }
path j = graph(h,xmin+0.3,xmax-0.3);
draw(j,blue,L=Label("$y=cotg^{-1}(x)$", UnFill,
position=EndPoint));
导致: