完成问题5和6

Signed-off-by: szdytom <szdytom@163.com>
This commit is contained in:
方而静 2023-04-21 13:34:54 +08:00
parent afc6b6349d
commit 792d099976
6 changed files with 176 additions and 21 deletions

16
assets/p5-intersect.svg Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="144.000000" height="143.999985" viewBox="0 0 144.000000 143.999985" version="1.1"><circle style="fill-rule:evenodd;fill:#FF7043;fill-opacity:1;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke:#616161;stroke-miterlimit:0.7;" cx="22" cy="22" r="10"/>
<circle style="fill-rule:evenodd;fill:#29B6F6;fill-opacity:1;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke:#616161;stroke-miterlimit:0.7;" cx="122" cy="122" r="10"/>
<circle style="fill-rule:evenodd;fill:#FF7043;fill-opacity:1;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke:#616161;stroke-miterlimit:0.7;" cx="22" cy="122" r="10"/>
<circle style="fill-rule:evenodd;fill:#29B6F6;fill-opacity:1;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke:#616161;stroke-miterlimit:0.7;" cx="122" cy="22" r="10"/>
<circle style="fill-rule:evenodd;fill:g;fill-opacity:1;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke:#616161;stroke-miterlimit:0.7;" cx="72" cy="72" r="10"/>
<path style="fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:#616161;stroke-miterlimit:0.7;" d="M 28.7175 28.7175 L 65.2825 65.2825 "/>
<path style="fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:#616161;stroke-miterlimit:0.7;" d="M 115.282 115.282 L 78.7175 78.7175 "/>
<path style="fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:#616161;stroke-miterlimit:0.7;" d="M 28.7175 115.282 L 65.2825 78.7175 "/>
<path style="fill:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke:#616161;stroke-miterlimit:0.7;" d="M 115.282 28.7175 L 78.7175 65.2825 "/>
<text font-family="Ubuntu Mono" fill="white" font-size="10.000000" style="text-anchor: middle;dominant-baseline: middle;"><tspan x="22.000004" y="21.999979">A</tspan></text>
<text font-family="Ubuntu Mono" fill="white" font-size="10.000000" style="text-anchor: middle;dominant-baseline: middle;"><tspan x="122.000000" y="121.999977">B</tspan></text>
<text font-family="Ubuntu Mono" fill="white" font-size="10.000000" style="text-anchor: middle;dominant-baseline: middle;"><tspan x="22.000004" y="121.999977">C</tspan></text>
<text font-family="Ubuntu Mono" fill="white" font-size="10.000000" style="text-anchor: middle;dominant-baseline: middle;"><tspan x="122.000000" y="21.999979">D</tspan></text>
<text font-family="Ubuntu Mono" fill="white" font-size="10.000000" style="text-anchor: middle;dominant-baseline: middle;"><tspan x="72.000000" y="71.999977">E</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

25
assets/p5-intersect.txt Normal file
View File

@ -0,0 +1,25 @@
OutputFile="p5-intersect.svg"
R=.1
Thickness=.01
BorderColor="#616161"
ColorMap:r="#FF7043"
ColorMap:b="#29B6F6"
ColorMap:g="#212121"
FontColor="white"
FontFamily="Ubuntu Mono"
Xaxis="right"
Yaxis="Down"
Label="A"
---
5
1 -2 r
2 -1 b
1 -1 r
2 -2 b
1.5 -1.5 g
4
1 5
2 5
3 5
4 5

10
lib.typ
View File

@ -1,13 +1,13 @@
#import "template.typ": *
#let pagebreak_until_odd() = locate(loc => {
#let pagebreak_until_odd() = {
pagebreak()
locate(loc => if calc.even(thispage_number(loc)) {
skip_footer.update(true)
pagebreak()
skip_footer.update(false)
})
})
}
#let italic(body) = text(style: "italic", body)
@ -32,6 +32,8 @@
#let frange = {$op("range")$}
#let dimrange = {$op("dim range")$}
#let fnull = {$op("null")$}
#let dimnull = {$op("dim null")$}
#let theme_blue = rgb("29B6F6")
#let theme_red = rgb("FF7043")
@ -41,4 +43,6 @@
#let math_numbering(body) = {
set math.equation(numbering: "(1)")
body
}
}
#let inprod(a,b) = {$angle.l #a,#b angle.r$}

102
main.typ
View File

@ -507,19 +507,103 @@ $ 2>=bf(E)(abs(X))=sum_(v in V)bf(P)(v in X)=sum_(v in V)1/(n-dd(v))>=n/(n-2m sl
红蓝各 1 个点的情况的情况是平凡的,下面均假设 $n>=2$
(反证法)假设不存在一种合法的配对方案。从全部配对方案中选出连接的线段长度之和最短的一种方案,根据反证假设一定存在两条线段相交,设相交的两条线段的红色端点分别为点 $A$ 和点 $B$,蓝色端点分别为点 $C$ 和点 $D$$A$ $C$ 配对,$B$ $D$ 配对,$A C$ $B D$ 的交点为 $E$
(反证法)假设不存在一种合法的配对方案。从全部配对可能的方案中选出连接的线段长度之和最短的一种方案之一,根据反证假设一定存在两条线段相交。如图,设相交的两条线段的红色端点分别为点 $A$ 和点 $B$,蓝色端点分别为点 $C$ 和点 $D$$A$ $C$ 配对,$B$ $D$ 配对,$A C$ $B D$ 的交点为 $E$
/*
#figure(image(
"./assets/p5-intersect.svg",
width: 40%
), caption: [交点示意图])
![交点示意图](https://s1.ax1x.com/2022/12/16/zHPDxI.png)
根据三角形不等式,一定有
根据三角形不等式(由于没有三点共线,等号一定不成立),一定有
$$\begin{aligned}|AD|&\leq|AE|+|DE|\\|BC|&\leq|BE|+|EC|\end{aligned}$$
#[
#show: math_numbering
$ abs(A D)&<abs(A E)+abs(D E) $ <P5eq1>
$ abs(B C)&<abs(B E)+abs(E C) $ <P5eq2>
]
由于没有三点共线,等号一定不成立,这说明
@P5eq1 @P5eq2 相加,得到
$$|AD|+|BC|<|AC|+|BD|$$
$ abs(A D)+abs(B C)<abs(A C)+abs(B D) $
那么 $A$ $D$$B$ $C$ 配对的方案一定比这种方案线段长度之和更短,矛盾,故假设不成立。于是合法方案一定存在。
*/
这说明,将 $A$ $D$$B$ $C$ 配对的方案一定比将 $A$ $B$$C$ $D$ 配对的方案的线段长度之和更短,这与反正假设矛盾,故假设不成立。于是合法方案一定存在,命题得证。
#pagebreak_until_odd()
#problem_type.update((algebra_icon, geometry_icon,))
= 距离为奇整数的点
求证:在平面上不存在 4 个点,使得任意一对点之间的距离均为某个奇整数。
== 提示
这里所说的距离是指欧几里得距离,即点 $(x_1,y_1)$ $(x_2,y_2)$ 之间的距离由
$ sqrt((x_1-x_2)^2+(y_1-y_2)^2) $
给出。
容易发现,平面上 3 个点两两之间的距离均为奇整数是可能的(边长为 1 的等边三角形)。
#pagebreak()
== 解答
(反证法)假设存在四个点两两之间的距离均为奇数。不妨设其中一个点为的向量 $bf(0)$,另外三个点的向量分别为 $a,b,c$。用记号 $inprod(u,v)$ 表示向量 $u$ 和向量 $v$ 的点积(又称“内积”),记号 $abs(v)$ 表示向量 $v$ 的模长(又称“绝对值”)。根据距离的定义,它们之间的关系由@P6eq1 给出。
#[
#show: math_numbering
$ abs(v)=sqrt(inprod(v,v)) $ <P6eq1>
根据反证假设,有 $abs(a)$$abs(b)$$abs(c)$$abs(a-b)$$abs(b-c)$ 以及 $abs(c-a)$ 均为奇整数。
考虑定义了模 8 意义下的加法和乘法整数域 $bb(Z)_8$,容易发现其中任意一个奇数的平方一定为 1。据此根据余弦定理和@P6eq1,得到
$ 2 inprod(a,b)=abs(a)^2+abs(b)^2-abs(a-b)^2=1 $ <P6odd1>
类似的,有
$ 2 inprod(a,c)=1 $ <P6odd2>
$ 2 inprod(b,c)=1 $ <P6odd3>
]
构造 $bb(Z)_8^(3 times 3)$ 上的矩阵 $B$
$ B=mat(delim: "[",
inprod(a,a),inprod(a,b),inprod(a,c);
inprod(b,a),inprod(b,b),inprod(b,c);
inprod(c,a),inprod(c,b),inprod(c,c)) $
根据@P6eq1@P6odd1@P6odd2 @P6odd3,有
$ 2B=mat(delim: "[",
2,1,1;
1,2,1;
1,1,2) $
我们用 $dim V$ 表示线性空间 $V$ 的维数,$frange T$ 表示线性变换 $T$ 的值域,$fnull T$ 表示线性变换 $T$ 的零空间(经过 $T$ 变为 $bf(0)$ 的向量构成的子空间)。容易验证 $dimrange 2B=3$,于是
#[
#show: math_numbering
$ dimrange B=3 $ <P6eq2>
]
另一方面,构造 $bb(Z)_8^(3 times 2)$ 上的矩阵 $A$,满足
$ A=mat(delim: "[",
a_1,b_1,c_1;
a_2,b_2,c_2) $
容易验证 $B=A^transpose A$,于是 $frange B subset.eq frange A^transpose$,另一方面,根据线性变换基本定理,有
$ dim bb(Z)_8^2=dimrange A^transpose+dimnull A^transpose $
这说明,$dimrange A^transpose<=2$,与@P6eq2 联立,得到
$ 3=dimrange B<=dimrange A^transpose<=2 $
这给出了 $3<=2$ 这样的错误的结果,故假设不成立,原命题得证。

14
scripts/diagram.svg Normal file
View File

@ -0,0 +1,14 @@
<svg width="550" height="356" viewBox="0 0 550 356" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="550" height="356" fill="white"/>
<path d="M19.7071 18.2929C19.3166 17.9024 18.6834 17.9024 18.2929 18.2929L11.9289 24.6569C11.5384 25.0474 11.5384 25.6805 11.9289 26.0711C12.3194 26.4616 12.9526 26.4616 13.3431 26.0711L19 20.4142L24.6568 26.0711C25.0474 26.4616 25.6805 26.4616 26.0711 26.0711C26.4616 25.6805 26.4616 25.0474 26.0711 24.6569L19.7071 18.2929ZM20 336L20 19L18 19L18 336L20 336Z" fill="black"/>
<path d="M525.707 336.707C526.098 336.317 526.098 335.683 525.707 335.293L519.343 328.929C518.953 328.538 518.319 328.538 517.929 328.929C517.538 329.319 517.538 329.953 517.929 330.343L523.586 336L517.929 341.657C517.538 342.047 517.538 342.681 517.929 343.071C518.319 343.462 518.953 343.462 519.343 343.071L525.707 336.707ZM19 337H525V335H19V337Z" fill="black"/>
<text fill="black" font-family="Stupid, Inria Serif" font-size="24" letter-spacing="0em"><tspan x="34.0469" y="43.9274">Height</tspan></text>
<text fill="black" font-family="Stupid, Inria Serif" font-size="24" font-style="italic" letter-spacing="0em"><tspan x="34.0469" y="72.9274">Height</tspan></text>
<text fill="black" font-family="Stupid, Inria Serif" font-size="24" font-weight="bold" letter-spacing="0em"><tspan x="34.0469" y="101.927">Height</tspan></text>
<text fill="black" font-family="Stupid, Inria Serif" font-size="24" font-style="italic" font-weight="bold" letter-spacing="0em"><tspan x="34.0469" y="130.927">Height</tspan></text>
<text fill="black" font-size="22" font-weight="bold" letter-spacing="0em"><tspan x="99.0469" y="278.783">Without family</tspan></text>
<text fill="black" font-family="Inter" font-size="22" font-style="italic" letter-spacing="0em"><tspan x="58.0469" y="315">With non-existing family</tspan></text>
<text fill="black" font-family="Roboto" font-size="24" letter-spacing="0em" text-decoration="underline"><tspan x="466" y="310.703">Time</tspan></text>
<path d="M20 335C20 335 59.8833 265.479 102 241C143.386 216.945 162.368 211.763 210 207C270 201 321.161 208.851 374 178C398.284 163.821 431 134 431 134L518 65" stroke="#2B80FF" stroke-width="2"/>
<text transform="translate(428.859 89.5114) rotate(-38.8045)" fill="#2B80FF" xml:space="preserve" style="white-space: pre" font-family="DejaVu Sans Mono" font-size="24" font-weight="bold" letter-spacing="0em"><tspan x="0" y="22.3086">Curve</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -24,6 +24,10 @@ const float vertex_R=.1; //点的半径
const float border_width=.01; //点的边框粗细
const string border_color="#616161"; //点的边框和边的颜色
const map<string,string> mp{{"b","#29B6F6"},{"r","#FF7043"}}; //颜色映射表
const string label = "A"; // 标签格式
const string font_family = "Ubuntu Mono"; // 字体
const string font_color = "white"; // 标签颜色
const float output_scale = 100;
vec calc(vec a,vec b)
{
@ -69,15 +73,17 @@ int main(int argc,char** argv)
for(int i=1;i<=n;i++) p[i].x-=X,p[i].y-=Y;
X=(maxX-X)+(maxX-minX)*XR;
Y=(maxY-Y)+(maxY-minY)*YR;
cout<<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"<<endl;
cout<<"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 "<<X<<" "<<Y<<"\" version=\"1.1\">"<<endl;
printf(R"(<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="%f" height="%f" viewBox="0 0 %f %f" version="1.1">)",
X * output_scale, Y * output_scale, X * output_scale, Y * output_scale);
for(int i=1;i<=n;i++)
{
cout<<"<circle style=\"fill-rule:evenodd;fill:"<<pc[i]<<
";fill-opacity:1;stroke-width:"<<border_width<<
";fill-opacity:1;stroke-width:"<<border_width*output_scale<<
";stroke-linecap:square;stroke-linejoin:miter;stroke:"<<border_color<<
";stroke-miterlimit:"<<border_width*0.7<<
";\" cx=\""<<p[i].x<<"\" cy=\""<<p[i].y<<"\" r=\""<<vertex_R<<"\"/>"<<endl;
";stroke-miterlimit:"<<border_width*0.7*output_scale<<
";\" cx=\""<<p[i].x*output_scale<<"\" cy=\""<<p[i].y*output_scale<<"\" r=\""<<vertex_R*output_scale<<"\"/>"<<endl;
}
cin>>m; //输入边数(int)
for(int i=1;i<=m;i++)
@ -86,11 +92,17 @@ int main(int argc,char** argv)
cin>>a>>b; //输入端点编号(int[1,n])
vec A=calc(p[a],p[b]);
vec B=calc(p[b],p[a]);
cout<<"<path style=\"fill:none;stroke-width:"<<border_width<<
cout<<"<path style=\"fill:none;stroke-width:"<<border_width*output_scale<<
";stroke-linecap:butt;stroke-linejoin:miter;stroke:"<<border_color<<
";stroke-miterlimit:"<<border_width*0.7<<
";\" d=\"M "<<A.x<<" "<<A.y<<" L "<<B.x<<" "<<B.y<<" \"/>"<<endl;
";stroke-miterlimit:"<<border_width*0.7*output_scale<<
";\" d=\"M "<<A.x*output_scale<<" "<<A.y*output_scale<<" L "<<B.x*output_scale<<" "<<B.y*output_scale<<" \"/>"<<endl;
}
if (label == "A" || label == "a") {
for (int i = 1; i <= n; ++i) {
printf(R"(<text font-family="%s" fill="%s" font-size="%f" style="text-anchor: middle;dominant-baseline: middle;"><tspan x="%f" y="%f">%c</tspan></text>
)", font_family.c_str(), font_color.c_str(), vertex_R * output_scale, p[i].x * output_scale, p[i].y * output_scale, i + label[0] - 1);
}
}
cout<<"</svg>"<<endl;
return 0;
}
}