Skip to content

Commit

Permalink
q
Browse files Browse the repository at this point in the history
  • Loading branch information
OverflowCat committed May 29, 2024
1 parent bd7a297 commit c049927
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
108 changes: 108 additions & 0 deletions chap11/4/Untitled-1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import statistics\n",
"from math import sqrt\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[2000.2012653069999, 2000.5753877569998, 2000.7624489819998, 2000.949510207, 2001.323632657, 2001.697755107]\n",
"[0.15873469300004217, 0.14461224300021058, 0.037551018000158365, 0.12048979299993334, 0.15636734300005628, -0.09775510700001178]\n",
"0.09604407965886559\n",
"0.15495489638832455\n"
]
}
],
"source": [
"x = [10, 20, 25, 30, 40, 50]\n",
"data = [2000.36, 2000.72, 2000.8, 2001.07, 2001.48, 2001.6]\n",
"\n",
"\"\"\"\n",
"=0.037412245,\n",
"=1999.827142857.\n",
"\"\"\"\n",
"\n",
"y = lambda x: 0.037412245*x + 1999.827142857\n",
"estimated = [y(i) for i in x]\n",
"print(estimated)\n",
"\n",
"\n",
"residuals = [x - y for x, y in zip(data, estimated)]\n",
"print(residuals)\n",
"rsum = sum(x**2 for x in residuals)\n",
"print(rsum)\n",
"stddev = sqrt(rsum / (len(data) - 2))\n",
"print(stddev)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.07920174661373738"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = [1.70,1.57,1.37,1.71]\n",
"mean = statistics.mean(data)\n",
"residuals = [x - mean for x in data]\n",
"rsum = sum(x**2 for x in residuals)\n",
"stddev = sqrt(rsum / (len(data) - 1))\n",
"stddev / sqrt(4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# 19.1 25.0 30.1 36.0 40.0 46.5 50.0\n",
"# 76.3 77.8 79.75 80.8 82.35 83.9 85.1\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
10 changes: 10 additions & 0 deletions expt03/main.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#set text(lang: "zh", cjk-latin-spacing: auto, font: "Noto Serif CJK SC")
#set page("iso-b5", numbering: "1", margin: (left: 1.4cm, right: 1.9cm))
#set par(leading: 1.1em)
#show table: set text(font: "Zhuque Fangsong (technical preview)")
#show figure.caption: set text(font: "Zhuque Fangsong (technical preview)")
#show "": ""
#show heading: set text(font: "Noto Sans CJK SC", size: 1.15em)

= 数字图像处理实验3

0 comments on commit c049927

Please sign in to comment.