148 lines
9.8 KiB
Plaintext
148 lines
9.8 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"题号: 010000 , 字段: solution 中已添加数据: (1) $S_{\\triangle ABC}=\\dfrac 12 \\cdot 2\\times 2\\times \\sin 60^\\circ=\\sqrt{3}$, 三棱锥的高$PO=2\\sin 60^\\circ = \\sqrt{3}$, 故$V_{P-ABC}=\\dfrac 13\\cdot S_{\\triangle ABC}\\cdot PO=\\dfrac 13\\times \\sqrt{3}\\times \\sqrt{3}=1$.\\\\\n",
|
|
"(2) 取$OC$中点$N$, 由于$MN\\parallel BO$, 且$BO\\perp AC$, 故$MN\\perp AC$. 又因为$PO\\perp$平面$ABC$, 故$MN\\perp PO$. 注意到$PO\\cap AC=O$, 于是$MN\\perp$平面$PAC$, 从而$PN$是$PM$在平面$PAC$上的射影. $MN=\\dfrac{\\sqrt{3}}{2}$, $PN=\\dfrac{\\sqrt{13}}{2}$, 故$\\angle MPN=\\arctan \\dfrac{MN}{PN}=\\arctan \\dfrac{\\sqrt{39}}{13}$. 综上, $PM$与平面$PAC$所成角的大小为$\\arctan \\dfrac{\\sqrt{39}}{13}$.\n",
|
|
"题号: 011301 , 字段: solution 中已添加数据: (1) 由$a^2+c^2-2ac\\cos B=b^2$, 即$c^2-5c-24=0$解得$c=8$或$-3$(负数舍去). 故$c=8$.\\\\\n",
|
|
"(2) 延长$CM$至$N$, 使得$CM=MN$, 则四边形$ACBN$是平行四边形, 故$S_{\\triangle ABC}=S_{\\triangle ACN}$. $\\triangle ACN$的三边长分别为$5,6,7$, 故$\\cos \\angle CAN=\\dfrac{5^2+7^2-6^2}{2\\times 5\\times 7}=\\dfrac{19}{35}$, 所以$\\sin \\angle CAN=\\dfrac{12\\sqrt{6}}{35}$. 由此, $S_{\\triangle ACN}=\\dfrac 12\\cdot AC\\cdot AN\\cdot \\sin \\angle CAN=6\\sqrt{6}$. 综上, 三角形$ABC$的面积为$6\\sqrt{6}$.\n",
|
|
"题号: 003691 , 字段: solution 中已添加数据: (1) 前$4$个月的累计投放量为$a_1+a_2+a_3+a_4=20+95+420+430=965$. 前$4$个月的累计损失量为$b_1+b_2+b_3+b_4=6+7+8+9=30$, 因此该地区第$4$个月底的共享单车的保有量为$965-30=935$.\\\\\n",
|
|
"(2) 考察不等式$a_n \\geq b_n$在整数范围内的解集. 当$n \\leq 3$时, $5 n^4+15 \\geq n+5$确实成立, 当$n \\geq 4$时, 由$-10 n+470 \\geq n+5$, 解得$n \\leq \\dfrac{465}{11}\\approx 42.27$, 因此第$42$个月底, 保有量达到最大. 当$n \\geq 4$时, $\\{a_n\\}$是公差为$-10$的等差数列, 而$\\{b_n\\}$是公差为$1$的等差数列, 于是到第$42$个月底, 单车保有量为$\\dfrac{38(a_5+a_{42})}{2}+965-\\dfrac{42(b_1+b_{42})}{2}=\\dfrac{38(420+50)}{2}+965-\\dfrac{42(6+47)}{2}=8782$. 而$S_{42}=-4\\times 16+8800=8736<8782$. 因此该月底单车保有量超过了容纳量.\n",
|
|
"题号: 011450 , 字段: solution 中已添加数据: (1) 设直线$l$的方程为$x=m$, 由$S_{\\triangle OPQ}=\\dfrac 12\\cdot |m|\\cdot |PQ|=\\dfrac{\\sqrt{2}}{2}$得$|PQ|=\\dfrac{\\sqrt{2}}{|m|}$, 于是点$(m,\\dfrac{\\sqrt{2}}{2|m|})$在椭圆上. 代入椭圆$C$的方程, 得$m^2+\\dfrac{2}{8m^2}=1$, 解得$m^2=\\dfrac 12$. 故直线$l$的方程为$x=\\dfrac{\\sqrt{2}}2$或$x=-\\dfrac{\\sqrt{2}}2$.\\\\\n",
|
|
"(2) 当直线$l$的斜率不存在时, 点$P,Q$关于$x$轴对称, 设$P(x_1,y_1)$, $Q(x_1,-y_1)$, 由$x_1^2+\\dfrac{y_1^2}{2}=1$及$|x_1y_1|=\\dfrac{\\sqrt{2}}{2}$解得$|x_1|=\\dfrac{\\sqrt{2}}2$, $|y_1|=1$, 故此时$x_1^2+x_2^2=1$, $y_1^2+y_2^2=2$.\\\\\n",
|
|
"当直线$l$的斜率存在时, 设直线$l$的方程为$y=kx+m$, 与椭圆$C$的方程联立, 整理得$(2+k^2)x^2+2kmx+m^2-2=0$, 由$\\dfrac 12|x_1y_2-x_2y_1|=\\dfrac 12|x_1(kx_2+m)-x_2(kx_1+m)|=\\dfrac 12|m||x_1-x_2|=\\dfrac{\\sqrt{2}}{2}$得$\\sqrt{2}(2+k^2)=|m|\\sqrt{2+k^2-m^2}$. 于是$2m^2=2+k^2$, $x_1^2+x_2^2=(x_1+x_2)^2-2x_1x_2=(\\dfrac{-2km}{2+k^2})^2-\\dfrac{2m^2-4}{2+k^2}=1$, $y_1^2+y_2^2=2(1-x_1^2+1-x_2^2)=2$.\\\\\n",
|
|
"(3) 假设这样的三角形存在, 则三点$D(x_1,y_1)$, $E(x_2,y_2)$, $G(x_3,y_3)$应满足$x_1^2+x_2^2=x_2^2+x_3^2=x_3^2+x_1^2=1$, 从而$x_1^2=x_2^2=x_3^2=\\dfrac 12$, 但椭圆$C$上任取横坐标为$\\pm \\dfrac{\\sqrt{2}}{2}$的三点, 总有两个点与原点共线, 此时三角形不存在, 矛盾. 因此假设不成立, 满足条件的三角形不存在.\n",
|
|
"题号: 031236 , 字段: solution 中已添加数据: (1) $f'(0)=\\mathrm{e}^0(\\dfrac{1}{1+0}+\\ln (1+0))=1$, 又$f(0)=0$, 故所求切线的方程为$y=x$.\\\\\n",
|
|
"(2) $g(x)=f'(x)=\\mathrm{e}^x(\\dfrac{1}{1+x}+\\ln (1+x))$. $g'(x)=\\mathrm{e}^x(\\ln (1+x)+\\dfrac{2}{1+x}-\\dfrac{1}{(1+x)^2})$, 当$x>0$时, $\\mathrm{e}^x>1>0$, $\\ln(1+x)>0$, 且$\\dfrac{2}{1+x}-\\dfrac{1}{(1+x)^2}=\\dfrac{2x+1}{(1+x)^2}>0$, 所以$g'(x)$在$(0,+\\infty)$上恒正. 因此$g(x)$在$[0,+\\infty)$上是严格增函数.\\\\\n",
|
|
"(3) 对于固定的常数$t$, 令$h(x)=f(x+t)-f(x)-f(t)$, 则$h(t)=0$, 而$h'(x)=f'(x+t)-f'(x)=g(x+t)-g(x)$. 由(2)可知$g(x+t)>g(x)$, 故$h'(x)$在$(0,+\\infty)$上恒正, 于是有$h(s)>h(0)=0$, 即$f(s+t)>f(s)+f(t)$.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"import os,re,json\n",
|
|
"\n",
|
|
"\"\"\"---明确数据文件位置---\"\"\"\n",
|
|
"datafile = \"文本文件/metadata.txt\"\n",
|
|
"# 双回车分隔,记录内单回车分隔列表,首行为字段名\n",
|
|
"\"\"\"---文件位置结束---\"\"\"\n",
|
|
"\n",
|
|
"def trim(string):\n",
|
|
" string = re.sub(r\"^[ \\t\\n]*\",\"\",string)\n",
|
|
" string = re.sub(r\"[ \\t\\n]*$\",\"\",string)\n",
|
|
" return string\n",
|
|
"def FloatToInt(string):\n",
|
|
" f = float(string)\n",
|
|
" if abs(f-round(f))<0.01:\n",
|
|
" f = round(f)\n",
|
|
" return f\n",
|
|
"\n",
|
|
"with open(datafile,\"r\",encoding=\"utf8\") as f:\n",
|
|
" data = f.read().strip()\n",
|
|
"pos = data.index(\"\\n\")\n",
|
|
"field = data[:pos].strip()\n",
|
|
"appending_data = data[pos:]\n",
|
|
"\n",
|
|
"with open(r\"../题库0.3/Problems.json\",\"r\",encoding = \"utf8\") as f:\n",
|
|
" database = f.read()\n",
|
|
"pro_dict = json.loads(database)\n",
|
|
"with open(r\"../题库0.3/LessonObj.json\",\"r\",encoding = \"utf8\") as f:\n",
|
|
" database = f.read()\n",
|
|
"obj_dict = json.loads(database)\n",
|
|
"\n",
|
|
"#该字段列表可能需要更新\n",
|
|
"fields = [\"content\",\"objs\",\"tags\",\"genre\",\"ans\",\"solution\",\"duration\",\"usages\",\"origin\",\"edit\",\"same\",\"related\",\"remark\",\"space\"]\n",
|
|
"\n",
|
|
"if field in fields:\n",
|
|
" field_type = type(pro_dict[\"000001\"][field])\n",
|
|
" datalist = [record.strip() for record in appending_data.split(\"\\n\\n\") if len(trim(record)) > 0]\n",
|
|
" for record in datalist:\n",
|
|
" id = re.findall(r\"^[\\d]{1,}\",record)[0]\n",
|
|
" data = record[len(id):].strip()\n",
|
|
" id = id.zfill(6)\n",
|
|
" if not id in pro_dict:\n",
|
|
" print(\"题号:\",id,\"不在数据库中.\")\n",
|
|
" break\n",
|
|
" \n",
|
|
" #字符串类型字段添加数据\n",
|
|
" elif field_type == str and data in pro_dict[id][field]:\n",
|
|
" print(\"题号:\",id,\", 字段:\",field,\"中已有该数据:\",data)\n",
|
|
" elif field_type == str and not data in pro_dict[id][field] and not field == \"ans\" and not field == \"space\":\n",
|
|
" origin_data = pro_dict[id][field]\n",
|
|
" new_data = trim(origin_data + \"\\n\" + data)\n",
|
|
" pro_dict[id][field] = new_data\n",
|
|
" print(\"题号:\",id,\", 字段:\",field,\"中已添加数据:\",data)\n",
|
|
" elif field_type == str and not data in pro_dict[id][field] and field == \"ans\" or field == \"space\":\n",
|
|
" pro_dict[id][field] = data\n",
|
|
" print(\"题号:\",id,\", 字段:\",field,\"中已修改数据:\",data)\n",
|
|
" \n",
|
|
" #数值类型字段添加数据\n",
|
|
" elif (field_type == int or field_type == float) and abs(float(data) - pro_dict[id][field])<0.01:\n",
|
|
" print(\"题号:\",id,\", 字段:\",field,\"中已有该数据:\",FloatToInt(data))\n",
|
|
" elif (field_type == int or field_type == float) and abs(float(data) - pro_dict[id][field])>=0.01:\n",
|
|
" pro_dict[id][field] = FloatToInt(data)\n",
|
|
" print(\"题号:\",id,\", 字段:\",field,\"中已修改数据:\",FloatToInt(data))\n",
|
|
" \n",
|
|
" #列表类型字段添加数据\n",
|
|
" elif field_type == list:\n",
|
|
" cell_data_list = [d.strip() for d in data.split(\"\\n\")]\n",
|
|
" for cell_data in cell_data_list:\n",
|
|
" if cell_data in pro_dict[id][field]:\n",
|
|
" print(\"题号:\",id,\", 字段:\",field,\"中已有该数据:\",cell_data)\n",
|
|
" elif not field == \"objs\":\n",
|
|
" pro_dict[id][field].append(cell_data)\n",
|
|
" print(\"题号:\",id,\", 字段:\",field,\"中已添加数据:\",cell_data)\n",
|
|
" else:\n",
|
|
" if not cell_data in obj_dict and not cell_data.upper() == \"KNONE\":\n",
|
|
" print(\"题号:\",id,\", 字段:\",field,\"目标编号有误:\",cell_data)\n",
|
|
" else:\n",
|
|
" pro_dict[id][field].append(cell_data.upper())\n",
|
|
" print(\"题号:\",id,\", 字段:\",field,\"中已添加数据:\",cell_data.upper())\n",
|
|
"\n",
|
|
"with open(r\"../题库0.3/Problems.json\",\"w\",encoding = \"utf8\") as f:\n",
|
|
" f.write(json.dumps(pro_dict,indent=4,ensure_ascii=False))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "mathdept",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.9.15"
|
|
},
|
|
"orig_nbformat": 4,
|
|
"vscode": {
|
|
"interpreter": {
|
|
"hash": "ff3c292c316ba85de6f1ad75f19c731e79d694e741b6f515ec18f14996fe48dc"
|
|
}
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|