|
本帖最后由 hbghlyj 于 2023-5-3 10:45 编辑
读Asymptote文档发现有一个内置函数real[] cubicroots(real a, real b, real c, real d); 正好可以用来画这道题的$u_0(x)$的图象import graph;size(300);
real epsilon = 0.2;
real f(real x) {
return cubicroots(1,0,1,-2exp(x-1))[0];
}
real xMin = 0;
real xMax = 1;
real yMin = 0;
real yMax = 1;
// Draw the function
path myFunc = graph(f, xMin, xMax, n=1000, join=operator ..);
draw(myFunc, blue, L=Label("$y^3+y=2e^{x-1}$", align=SE));
// Draw the dashed horizontal asymptote
draw((xMin, 1)--(xMax, 1)--(xMax,0), dashed+red);
// Draw the doublehead arrow and labels
draw((1,0)--(epsilon,0), Arrows, L=Label("$O(\epsilon)$",position=1,align=S));
draw((epsilon,1)--(epsilon,f(epsilon))--(1,f(epsilon)),dashed);
label("$0$", (0,0), SW);
label("$1$", (xMax,0), S);
label("$1$", (0,yMax), W);
label("$C$", (0,0.560074), W);
xaxis(xMin, xMax);
yaxis(yMin, yMax); | Outer expansion | import graph;size(300);
real C = 0.560074;
real epsilon = 0.2;
real f(real x) {
return C*(1-exp(-x/epsilon));
}
real xMin = 0;
real xMax = 1;
real yMin = 0;
real yMax = C*1.1;
// Draw the function
path myFunc = graph(f, xMin, xMax, n=1000, join=operator ..);
draw(myFunc, blue, L=Label("$y=C(1-e^{-x/\epsilon})$", align=SE));
// Draw the dashed horizontal asymptote
draw((xMin, C)--(xMax, C), dashed+red);
// Draw the doublehead arrow and labels
draw((0,0)--(epsilon,0), Arrows, L=Label("$O(\epsilon)$",position=1,align=S));
draw((epsilon,0)--(epsilon,f(epsilon))--(0,f(epsilon)),dashed);
label("$0$", (0,0), SW);
label("$1$", (xMax,0), S);
label("$C$", (0,C), W);
xaxis(xMin, xMax);
yaxis(yMin, yMax); | Inner expansion | import graph;size(300);
real C = 0.560074;
real epsilon = 0.2;
real f(real x) {
return C*(1-exp(-x/epsilon))+cubicroots(1,0,1,-2exp(x-1))[0]-C;
}
real xMin = 0;
real xMax = 1;
real yMin = 0;
real yMax = 1;
// Draw the function
path myFunc = graph(f, xMin, xMax, n=1000, join=operator ..);
draw(myFunc, blue, L=Label("$y=u_0(x)-Ce^{-x/\epsilon}$", align=SE));
draw((xMin, 1)--(xMax, 1)--(xMax,0), dashed+red);
label("$0$", (0,0), SW);
label("$1$", (xMax,0), S);
label("$1$", (0,yMax), W);
xaxis(xMin, xMax);
yaxis(yMin, yMax); | Composite expansion |
|
|