Asymptote図形描画スクリプト集

雑記Topに戻る

Asymptoteはプログラミング言語であり、スクリプトを記述することによって図形を描画します。

本家のHPには色々と使用例・応用例が掲載されていますが、微妙に欲しい絵が無かったりするので、当サイトで独自に収集したスクリプト(主に図形描画)を公開します。少しずつ増やしていく予定です。

因みに、AsymptoteのスクリプトはAoPSのTeXeRのページ(外部リンク)などで画像として出力できます。スクリプトをベタ書きして “RENDER AS IMAGE” または “RENDER AS BBCODE” を選択すればOK。AoPSのTeXeRはAsymptoteに限らずLaTeXについてもオンラインアプリ感覚で使えるので非常に便利です。

AoPS内の「Asymptote」カテゴリに分類されているページはこちらからどうぞ。初心者にとっては参考になると思います。


Asymptote is a powerful descriptive vector graphics language that provides a natural coordinate-based framework for technical drawing. Labels and equations are typeset with LaTeX, the de-facto standard for typesetting mathematics.

「Asymptote」は、技術的な描画のための自然座標系のフレームワークを提供する強力な記述ベクタ形式言語です。ラベルや方程式は、数学組版の事実上のスタンダードである「LaTeX」によって組版されます。


因みに、Asymptote形式のデータは図形描画オンラインアプリ「Geogebra」を利用して生成することができます。ただし座標成分による制御なのでコードは綺麗にならないのが難点。


角の二等分線①:

» スクリプトを見る

[asy]
defaultpen(fontsize(14pt));
size(200);
pair A, B, C, D, I;
B = (0,0);
C = (5,0);
A = IP(Circle(B, 4), Circle(C, 5), 0);
I = incenter(A, B, C);
D = extension(A, I, B, C);
draw(A--B--C--cycle, black);
draw(A--D, red);
dot("$A$", A, dir(120));
dot("$B$", B, dir(220));
dot("$C$", C, dir(320));
dot("$D$", D, dir(240));
[/asy]

» 閉じる


角の二等分線②:

参考ページ:【平面図形】その相似が見えますか?③

» スクリプトを見る

[asy]
size(20cm);
defaultpen(fontsize(18pt));
pen bk=black;
pen light=lightgreen;
pen deep=deepgreen;

pair O,A,B,C,I,D,F,G,E,o,M,H;
O=(0,0);A=dir(140);B=dir(200);C=dir(340);
I=incenter(A,B,C);path w=circumcircle(A,B,C);
D=intersectionpoint(B--C,2I-A--A);
F=intersectionpoints(w,3I-2A--A)[1];
G=-F;E=extension(A,G,B,C);
o=-D;M=midpoint(B--C);H=foot(D,E,F);

draw(A--B--C--cycle,bk);draw(w,bk);
draw(G--E,deep);draw(B--E,deep);draw(A--F,deep);
draw(G--H,deep);draw(E--F,deep);draw(o--F,deep);
draw(G--o,deep);draw(D--o,deep);draw(G--F,deep);

dot("$O$",O,S);
dot("$A$",A,dir(A));
dot("$B$",B,dir(B));
dot("$C$",C,dir(C));
dot("$D$",D,dir(D));
dot("$F$",F,dir(F));
dot("$G$",G,dir(G));
dot("$E$",E,dir(E));
dot("$D'$",o,dir(o));
dot("$M$",M,dir(M));
dot("$H$",H,dir(H));
[/asy]

» 閉じる


内分点①:

» スクリプトを見る

[asy]
import geometry;
size(6cm);
triangle t=triangleabc(4,5,6);
label(t); draw(t,linewidth(bp));
point pE=midpoint(t.AB),
pF=t.A+(1/3)*(t.C-t.A),
pG=t.B+(1/3)*(t.C-t.B);
dot("$E$",pE,-dir(t.VC));
dot("$F$",pF,-dir(t.VB));
dot("$G$",pG,-dir(t.VA));
draw(segment(t.AB),
StickIntervalMarker(2,2,angle=-35));
draw(t.C--pE^^t.B--pF^^t.A--pG);
line CE=line(t.C,pE);
line AG=line(t.A,pG);
dot(intersectionpoint(CE,AG));
[/asy]

» 閉じる


外接円①:

» スクリプトを見る

[asy]
defaultpen(fontsize(10pt));
size(200);
pair A, B, C, D, E, F, I, P, MA, MB, MC;
B = (0,0);
C = (5,0);
A = IP(Circle(B, 4), Circle(C, 6), 0);
I = incenter(A, B, C);
D = extension(A, I, B, C);
P = midpoint(A--D);
E = extension(P, rotate(90, P)*A, B, I);
F = extension(P, rotate(90, P)*A, C, I);
MA = IP(Line(A, I, 20), circumcircle(A, B, C), 1);
MB = IP(Line(B, I, 20), circumcircle(A, B, C), 1);
MC = IP(Line(C, I, 20), circumcircle(A, B, C), 1);
draw(A--B--C--cycle, orange);
draw(circumcircle(A, B, C), red);
draw(A--E--F--cycle, lightblue);
draw(E--D--F, lightblue);
draw(A--MA^^B--MB^^C--MC, heavygreen);
draw(MA--MB--MC--cycle, magenta);
dot("$A$", A, dir(120));
dot("$B$", B, dir(220));
dot("$C$", C, dir(320));
dot("$D$", D, dir(230));
dot("$E$", E, dir(330));
dot("$F$", F, dir(250));
dot("$I$", I, dir(80));
dot("$M_A$", MA, dir(270));
dot("$M_B$", MB, dir(60));
dot("$M_C$", MC, dir(150));
[/asy]

» 閉じる


外接円②:

» スクリプトを見る

[asy]
size(8cm);
defaultpen(fontsize(10pt));

pair A = dir(115), B = dir(210), C = dir(330), D = A+dir(A--foot(A,B,C))*0.9, E = foot(D,A,C), F = foot(D,A,B), G = intersectionpoints(circumcircle(A,E,F),unitcircle)[1], P = extension(D,G,E,F), X = intersectionpoint(P--P+dir(A--P)*100,unitcircle), O = origin, T = extension(A,O,E,F);

draw(A--B--C--A);
draw(unitcircle^^circumcircle(A,E,F), gray);
draw(D--G--T^^A--G^^E--F^^O--A--X, gray);
draw(circumcircle(A,G,T), gray);
draw(circumcircle(G,T,O), dashed);
draw(A--foot(A,B,C), dotted);

dot("$A$", A, dir(105));
dot("$B$", B, dir(210));
dot("$C$", C, dir(330));
dot("$D$", D, dir(270));
dot("$E$", E, dir(10));
dot("$F$", F, dir(200));
dot("$G$", G, dir(135));
dot("$P$", P, dir(285));
dot("$O$", O, dir(210));
dot("$T$", T, dir(345));
dot("$X'$", X, dir(240));
[/asy]

» 閉じる


外接円③:

» スクリプトを見る

[asy] size(5cm); defaultpen(fontsize(10pt)); pen pri=lightred; pen sec=orange; pen tri=purple+pink; pen qua=lightblue; pen qui=lightolive; pen fil=invisible; pen sfil=invisible; pen tfil=invisible; pen qfil=invisible;

pair A,B,C,H,M,I,D,EE,Q; A=dir(110); B=dir(210); C=dir(330); H=A+B+C; M=(B+C)/2; I=incenter(A,B,C); D=extension(A,B,H,H+rotate(90)*(A-I)); EE=extension(A,C,H,H+rotate(90)*(A-I)); Q=reflect(origin,circumcenter(A,D,EE))*A;

draw(A--Q--M,qui); filldraw(circumcircle(A,D,EE),sfil,sec); filldraw(unitcircle,fil,pri); filldraw(A--B--C--cycle,fil,pri); filldraw(Q--B--D--cycle,tfil,tri); filldraw(Q--C--EE--cycle,tfil,tri); filldraw(H--B--D--cycle,qfil,qua); filldraw(H--C--EE--cycle,qfil,qua);

dot("\(A\)",A,A); dot("\(B\)",B,B); dot("\(C\)",C,C); dot("\(H\)",H,dir(60)); dot("\(M\)",M,S); dot("\(D\)",D,dir(210)); dot("\(E\)",EE,dir(15)); dot("\(Q\)",Q,Q); [/asy]

» 閉じる


外接円④:

» スクリプトを見る

[asy]
size(7cm);defaultpen(fontsize(10pt));pen org=magenta;pen med=mediummagenta;pen light=pink;pen deep=deepmagenta;pen dark=darkmagenta;pen heavy=heavymagenta;

pair O,A,B,C,D,M,N,P,Q,R;
O=(0,0);A=dir(110);B=dir(200);C=dir(340);D=foot(A,B,C);M=midpoint(B--C);N=2D-M;path w=circumcircle(A,M,N);P=intersectionpoints(w,A--B)[1];Q=intersectionpoints(w,A--C)[0];
R=extension(P,Q,B,C);path q=circumcircle(B,P,Q);

draw(A--B--C--cycle,deep);draw(w,med);draw(A--N,light);draw(B--Q,light);draw(C--P,light);
draw(Q--R--B,deep);draw(circumcircle(B,P,Q),light+dashed);

dot("$A$",A,dir(A));
dot("$B$",B,dir(B));
dot("$C$",C,dir(C));
dot("$D$",D,dir(D));
dot("$M$",M,dir(M));
dot("$N$",N,dir(N));
dot("$P$",P,dir(P));
dot("$Q$",Q,dir(Q));
dot("$R$",R,dir(R));
[/asy]

» 閉じる


外接円⑤:

※参考:INAMO 2023 P7 (OSN 2023)

» スクリプトを見る

[asy]
usepackage("tikz");
label("\begin{tikzpicture}[font=\small]
\coordinate[label=below left:$C$] (C) at (0,0);
\coordinate[label=above:$A$] (A) at (0,6);
\coordinate[label=below:$B$] (B) at (5,0);
\coordinate[label=above right:$O$] (O) at (2.5,3);
\coordinate[label=below:$P$] (P) at (2.5,-2.08);
\coordinate[label=right:$M$] (M) at (3.75,-1.04);
\coordinate[label=above left:$N$] (N) at (3.09,-.86);
\coordinate[label=above right:$E$] (E) at (4.06,1.13);
\coordinate[label=below:$D$] (D) at (2.03,-.56);
\draw[thick] (A)--(B)--(C)--cycle;
\draw[thick] (C)--(P)--(B);
\draw[thick] (D)--(E)--(P);
\draw[dashed] (1.93,.94) circle (2.14);
\draw[thick] (C)--(E);
\draw[thick] (C)--(M);
\draw[thick] (C)--(O)--(N);
\draw[thick] (O) circle (3.91);
\draw[thick] (B)--(N);
\coordinate[label=below right:$N'$] (N') at (4.41,-1.22);
\draw[thick] (P)--(N')--(B);
\draw[thick] (M)--(N');
\draw[dotted] (2.5,.46) circle (2.54);
\foreach \s in {A,B,C,O,E,D,M,N,P,N'}\filldraw (\s) circle (1.5pt);
\end{tikzpicture}");
[/asy]

» 閉じる


内接円①:

» スクリプトを見る

[asy] unitsize(2.5cm); pair A = dir(75); pair B = dir(200); pair C = dir(-20);
pair T_a = 2*B*C/(B+C); pair T_b = 2*C*A/(C+A); pair T_c = 2*A*B/(A+B); pair D = foot(A, B, C); pair E = foot(B, C, A); pair F = foot(C, A, B); pair H = A+B+C; pair H_a = -B*C/A; pair H_b = -C*A/B; pair H_c = -A*B/C;
pair Q = 2*C*H_b/(H_b+C); pair P = 2*B*H_c/(H_c+B);
filldraw(T_a--T_b--T_c--cycle, invisible, magenta); draw(A--B--C--cycle, blue); draw(A--H_a, lightblue); draw(B--H_b, lightblue); draw(C--H_c, lightblue); filldraw(unitcircle, invisible, blue);
draw(H_b--Q, red); draw(H_c--P, red); draw(Q--P, dashed+red); pair O = origin; pair N = midpoint(O--H); draw(A--N, red);
filldraw(circumcircle(T_a, P, Q), invisible, deepgreen); pair R1 = IP(unitcircle, circumcircle(T_a, P, Q)); pair R2 = OP(unitcircle, circumcircle(T_a, P, Q)); draw(R1--R2, deepgreen+1);
dot("$A$", A, dir(A)); dot("$B$", B, dir(B)); dot("$C$", C, dir(C)); dot("$T_a$", T_a, dir(T_a)); dot("$T_b$", T_b, dir(T_b)); dot("$T_c$", T_c, dir(T_c)); dot("$D$", D, dir(D)); dot("$E$", E, dir(E)); dot("$F$", F, dir(F)); dot("$H$", H, dir(H)); dot("$H_a$", H_a, dir(H_a)); dot("$H_b$", H_b, dir(H_b)); dot("$H_c$", H_c, dir(H_c)); dot("$Q$", Q, dir(Q)); dot("$P$", P, dir(P)); dot("$O$", O, dir(270)); dot("$N$", N, dir(330)); dot(R1); dot(R2);
/* TSQ Source:
!unitsize(2.5cm); A = dir 75 B = dir 200 C = dir -20
T_a = 2*B*C/(B+C) T_b = 2*C*A/(C+A) T_c = 2*A*B/(A+B) D = foot A B C E = foot B C A F = foot C A B H = A+B+C H_a = -B*C/A H_b = -C*A/B H_c = -A*B/C
Q = 2*C*H_b/(H_b+C) P = 2*B*H_c/(H_c+B)
T_a--T_b--T_c--cycle 0.1 pink / magenta A--B--C--cycle blue A--H_a lightblue B--H_b lightblue C--H_c lightblue unitcircle 0.1 lightcyan / blue
H_b--Q red H_c--P red Q--P dashed red O = origin R270 N = midpoint O--H R330 A--N red
circumcircle T_a P Q 0.02 yellow / deepgreen R1 .= IP unitcircle circumcircle T_a P Q R2 .= OP unitcircle circumcircle T_a P Q R1--R2 deepgreen+1
*/ [/asy]

» 閉じる


内接円②:

» スクリプトを見る

[asy]
size(8cm); defaultpen(fontsize(9pt)); pathpen=black; pointpen=black;
pair A=dir(55);
pair B=dir(-140);
pair C=dir(-40);
pair D=midpoint(B--C);
pair E=midpoint(A--C);
pair F=midpoint(A--B);
pair I=incenter(A,B,C);
pair P=foot(I,B,C);
pair P2=2*D-P;
pair P1=2*I-P;
pair U=OP(incircle(A,B,C),P1--P2);
pair V=IP(E--F,P1--U);
pair X=extension(E,F,D,U);
pair X1=2*X-V;

D(A--B--C--cycle,purple+linewidth(1.1));
D(incircle(A,B,C),dotted+red);
D(A--P2,cyan);
D(D--X,dashed);
D(X1--E,red+linewidth(1.2));
D(X1--P--P1);
D(E--U--F);
D(rightanglemark(P,U,P1,2),deepgreen);

dot("$A$",A,dir(A));
dot("$B$",B,dir(B));
dot("$C$",C,dir(C));
dot("$D$",D,dir(D));
dot("$E$",E,dir(E));
dot("$F$",F,dir(F));
dot("$I$",I,dir(I));
dot("$P$",P,dir(P));
dot("$P_1$",P1,dir(120));
dot("$P_2$",P2,dir(P2));
dot("$U$",U,dir(-160));
dot("$V$",V,dir(135));
dot("$X$",X,dir(90));
dot("$X^*$",X1,dir(90));
[/asy]

» 閉じる


内接円③:

» スクリプトを見る

[asy]
size(10cm);
pair A = dir(110);
pair B = dir(210);
pair C = dir(330);
pair I = incenter(A,B,C);
pair A1 = foot(I,B,C);
pair E = (A+C)/2;
pair F = (A+B)/2;
pair D = (B+C)/2;
path inc = incircle(A,B,C);
pair A4 = B+C-A1;
pair A3 = foot(A1,A,A4);
pair A2 = 2*I-A1;
pair X = extension(D,A3,F,E);
draw(A--B--C--A--cycle);
draw(inc);
draw(E--F);
draw(F--X);
draw(D--X);
draw(A--A4);
dot("$A$",A,dir(A));
dot("$B$",B,dir(B));
dot("$C$",C,dir(C));
dot("$D$",D,dir(D));
dot("$E$",E,dir(E));
dot("$F$",F,dir(F));
dot("$I$",I,dir(I));
dot("$X$",X,dir(X));
dot("$A_1$",A1,dir(A1));
dot("$A_2$",A2,dir(A2));
dot("$A_3$",A3,dir(A3));
dot("$A_4$",A4,dir(A4));
[/asy]

» 閉じる


垂心:

» スクリプトを見る

[asy]
size(10cm);
defaultpen(fontsize(12pt));

pair A = dir(105), B = dir(210), C = dir(330), H = orthocenter(A,B,C), D = foot(A,B,C), M = (B+C)/2, R = dir(75), D1 = 2M-D, A1 = 2M-H, Q = 2*D1-R, P = extension(A,R,H,D1), G = foot(H,P,Q);

draw(unitcircle^^circumcircle(H,G,Q));
draw(B--C^^A--P--Q--R--A--D^^A1--H--D1^^P--H--G);

dot("$A$", A, dir(95));
dot("$B$", B, dir(180));
dot("$C$", C, dir(0));
dot("$H$", H, dir(50));
dot("$D$", D, dir(270));
dot("$M$", M, dir(240));
dot("$D'$", D1, dir(315));
dot("$A'$", A1, dir(320));
dot("$P$", P, dir(150));
dot("$G$", G, dir(180));
dot("$Q$", Q, dir(285));
dot("$R$", R, dir(75));
[/asy]

» 閉じる


その他の円①:

» スクリプトを見る

[asy]
import geometry;
size(10cm);
pair sp(pair X)
{
return shift(-0.05, -0.02)*(rotate(-20)*X);
}
pair C1 = dir(60), C2 = dir(0), C3 = dir(-60), C4 = dir(-120), C5 = dir(180), C6 = dir(120);
pair B2 = sp(C1), B3 = sp(C2), B4 = sp(C3), B5 = sp(C4), B6 = sp(C5), B1 = sp(C6);
pair A1 = intersectionpoint(line(B6, B1), line(C6, C1));
pair A3 = intersectionpoint(line(B1, B2), line(C1, C2));
pair A5 = intersectionpoint(line(B2, B3), line(C2, C3));
pair A7 = intersectionpoint(line(B3, B4), line(C3, C4));
pair A9 = intersectionpoint(line(B4, B5), line(C4, C5));
pair A11 = intersectionpoint(line(B5, B6), line(C5, C6));

draw(B1--B2--B3--B4--B5--B6--cycle, red);
draw(C1--C2--C3--C4--C5--C6--cycle, blue);
draw(circumcircle(A1, B1, C1)^^circumcircle(A3, B2, C2)^^circumcircle(A5, B3, C3)^^circumcircle(A7, B4, C4)^^circumcircle(A9, B5, C5)^^circumcircle(A11, B6, C6), gray);
pair X = intersectionpoints(circumcircle(A1, B1, C1), circumcircle(A3, B2, C2))[1];
draw(A1--A7^^A3--A9^^A5--A11, heavygreen+dashed);

string[] names = {"$B_1$", "$B_2$", "$B_3$", "$B_4$", "$B_5$", "$B_6$", "$C_1$", "$C_2$", "$C_3$", "$C_4$", "$C_5$", "$C_6$", "$A_1$", "$A_3$", "$A_5$", "$A_7$", "$A_9$", "$A_{11}$", "$X$"};
pair[] points = {B1, B2, B3, B4, B5, B6, C1, C2, C3, C4, C5, C6, A1, A3, A5, A7, A9, A11, X};
pair[] ll = {B1, B2, B3, B4, B5, B6, C1, C2, C3, C4, C5, C6, A1, A3, A5, A7, A9, A11, N};
for (int i=0; i<names.length; ++i){ dot(names[i], points[i], ll[i]); }
[/asy]

» 閉じる


その他の円②:

» スクリプトを見る

[asy]
import geometry;
size(10cm);
pair sp(pair X)
{
return shift(-0.05, -0.02)*(rotate(-20)*X);
}
pair C1 = dir(60), C2 = dir(0), C3 = dir(-60), C4 = dir(-120), C5 = dir(180), C6 = dir(120);
pair B2 = sp(C1), B3 = sp(C2), B4 = sp(C3), B5 = sp(C4), B6 = sp(C5), B1 = sp(C6);
pair A1 = intersectionpoint(line(B6, B1), line(C6, C1));
pair A3 = intersectionpoint(line(B1, B2), line(C1, C2));
pair A5 = intersectionpoint(line(B2, B3), line(C2, C3));
pair A7 = intersectionpoint(line(B3, B4), line(C3, C4));
pair A9 = intersectionpoint(line(B4, B5), line(C4, C5));
pair A11 = intersectionpoint(line(B5, B6), line(C5, C6));

draw(B1--B2--B3--B4--B5--B6--cycle, red);
draw(C1--C2--C3--C4--C5--C6--cycle, blue);
draw(circumcircle(A1, B1, C1)^^circumcircle(A3, B2, C2)^^circumcircle(A5, B3, C3)^^circumcircle(A7, B4, C4)^^circumcircle(A9, B5, C5)^^circumcircle(A11, B6, C6), gray);
pair X = intersectionpoints(circumcircle(A1, B1, C1), circumcircle(A3, B2, C2))[1];
draw(A1--A7^^A3--A9^^A5--A11, heavygreen+dashed);

string[] names = {"$B_1$", "$B_2$", "$B_3$", "$B_4$", "$B_5$", "$B_6$", "$C_1$", "$C_2$", "$C_3$", "$C_4$", "$C_5$", "$C_6$", "$A_1$", "$A_3$", "$A_5$", "$A_7$", "$A_9$", "$A_{11}$", "$X$"};
pair[] points = {B1, B2, B3, B4, B5, B6, C1, C2, C3, C4, C5, C6, A1, A3, A5, A7, A9, A11, X};
pair[] ll = {B1, B2, B3, B4, B5, B6, C1, C2, C3, C4, C5, C6, A1, A3, A5, A7, A9, A11, N};
for (int i=0; i<names.length; ++i){ dot(names[i], points[i], ll[i]); }
[/asy]

» 閉じる


その他の円③:

» スクリプトを見る

[asy]
size(8cm);
pair A, B, C, D, EE, F, H, M, NN, K, L, T;
A=(0, 16);
B=(-28+12sqrt(3), 0);
C=(12sqrt(3)-4, 0);
D=foot(A, B, C);
EE=foot(B, C, A);
F=foot(C, A, B);
H=extension(B, EE, C, F);
M=(B+C)/2;
NN=circumcenter(A, F, EE);
K=(M+EE)/2;
L=(M+F)/2;
T=extension(A, B+(0, 16), K, L);
draw(A -- B -- C -- cycle, red);
draw(A -- D, orange); draw(B -- EE, orange); draw(C -- F, orange);
draw(L -- T -- A, red);
draw(F -- M -- EE -- NN -- cycle, orange);
draw(F -- EE, orange);
draw(M -- A, red);
draw(circumcircle(A, F, EE), orange);
dot("$A$", A, N);
dot("$B$", B, SW);
dot("$C$", C, SE);
dot("$D$", D, S);
dot("$E$", EE, NE);
dot("$F$", F, W);
dot("$M$", M, S);
dot("$K$", K, dir(60));
dot("$L$", L, S);
dot("$T$", T, NE);
[/asy]

» 閉じる


トロコイド:

» スクリプトを見る

[asy]
import graph;
size(200);
usepackage("inputenc","utf8"); usepackage("icomma");
xaxis("$x$", Ticks(scale(.7)*Label(), NoZero),Arrow(2mm));
yaxis("$y$", Ticks(scale(.7)*Label(), NoZero, beginlabel=false, endlabel=false, begin=false, end=false), Arrow(2mm));
labelx(scale(.7)*"$O$",0,SW);
real x(real t) {return 2*cos(t)+1.5*cos(2*t);}
real y(real t) {return 2*sin(t)-1.5*sin(2*t);}
pen pg = royalblue;
draw(graph(x,y,0,2*pi),bp+pg);
label(scale(.7)*"$x(t)=2\cos(t)+1,5\cos(2t)$",(1.8,-2),1.5N,pg);
label(scale(.7)*"$y(t)=2\sin(t)-1,5\sin(2t)$",(1.8,-2),pg);
[/asy]

» 閉じる


トロコイド②(カーディオイドの一部?→入試問題):

» スクリプトを見る

[asy]
import graph;
unitsize(1cm);

// 曲線Cの定義
real x(real t) { return 3*cos(t) - cos(3*t); }
real y(real t) { return 3*sin(t) - sin(3*t); }

path C = graph(x,y,0,pi/2,operator ..);

// x軸とy軸を描画
draw((-1,0)--(5,0),EndArrow);
draw((0,-1)--(0,5),EndArrow);

// Cを描画
draw(C,linewidth(1));

// 補助線
draw((0,sqrt(2))--(2*sqrt(2),sqrt(2)),dashed);
draw((2*sqrt(2),0)--(2*sqrt(2),sqrt(2)),dashed);

// ラベル
label("$O$", (0,0), SW);
label("$\sqrt{2}$", (0,sqrt(2)), W);
label("$4$", (0,4), W);
label("$2$", (2,0), S);
label("$2\sqrt{2}$", (2*sqrt(2),0), S);
label("$y$", (0,5), N);
label("$x$", (5,0), E);
label("$C$", (3,2.5), NE);

// 出力
shipout(format="pdf");
[/asy]

» 閉じる


ヘヴィサイド関数(Heaviside function):

» スクリプトを見る

[asy]
size(300,300);

// Function.
real[] x1 = {-1.5,0};
real[] y1 = {0,0};
real[] x2 = {0,1.5};
real[] y2 = {1,1};
draw(graph(x1,y1),red+2);
draw(graph(x2,y2),red+2);

draw((0,0)--(0,1),red+1.5+linetype("4 4"));
fill( circle((0,1),0.035), red);
filldraw( circle((0,0),0.03), white, red+1.5);

// Axes.
xaxis( Label("$x$"), Ticks(new real[]{-1,-0.5,0.5,1}), Arrow);
yaxis( Label("$y$"), Ticks(new real[]{0.5,1}), Arrow, ymin=-0.18, ymax=1.25);
// Origin.
labelx("$O$",0,SW);
[/asy]

» 閉じる


片対数グラフ:

» スクリプトを見る

[asy]
import graph;
size(200,200,IgnoreAspect);

real f(real t) {return 1/t;}

scale(Log,Log);
draw(graph(f,0.01,10),red);
pen thin=linewidth(0.5*linewidth());
xaxis("$x$",BottomTop,LeftTicks(begin=false,end=false,extend=true,
                                ptick=thin));
yaxis("$y$",LeftRight,RightTicks(begin=false,end=false,extend=true,
                                 ptick=thin));
[/asy]

» 閉じる


ベクトル場:

» スクリプトを見る

[asy]
import graph;
size(200);

pair a=(0,0);
pair b=(2pi,2pi);

path vector(pair z) {return (0,0)--(sin(z.x),cos(z.y));}

add(vectorfield(vector,a,b));
[/asy]

» 閉じる


立方体:

» スクリプトを見る

[asy]
import three;
unitsize(1cm);
size(200);
currentprojection=perspective(1/3,-1,1/2);
draw((0,0,0)--(1,0,0)--(1,1,0)--(0,1,0)--cycle,red);
draw((0,0,0)--(0,0,1),red);
draw((0,1,0)--(0,1,1),red);
draw((1,1,0)--(1,1,1),red);
draw((1,0,0)--(1,0,1),red);
draw((0,0,1)--(1,0,1)--(1,1,1)--(0,1,1)--cycle,red);
draw((0,0,0)--(1,0,0)--(1,1,0)--cycle,red);
draw((0,0,0)--(1,1,0)--(1,1,1)--cycle,blue);
label("$o$",(0,0,0),NW);
label("$x=1$",(0.5,0,0),S);
label("$y=1$",(1,1,0.5),E);
label("$z=1$",(1,0.5,0),SE);
label("$c$",(0.5,0.5,0.5),N);
[/asy]

» 閉じる


雑記Topに戻る