ref: split program into classes
This commit is contained in:
55
test.ipynb
Normal file
55
test.ipynb
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"100.00078395707533 -0.0007839570753276348\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"h = 100\n",
|
||||
"R = 6378 * 1000\n",
|
||||
"\n",
|
||||
"def solve_x2(a, b, c):\n",
|
||||
" d = b ** 2 - 4 * a * c\n",
|
||||
" x1 = (-b - d ** 0.5) / (2 * a)\n",
|
||||
" x2 = (-b + d ** 0.5) / (2 * a)\n",
|
||||
" return x1, x2\n",
|
||||
"\n",
|
||||
"x1, x2 = solve_x2(2, -2 * (h + R), 2 * h * R + h ** 2)\n",
|
||||
"\n",
|
||||
"y = h - x1\n",
|
||||
"\n",
|
||||
"print(x1, y)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"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.13.1"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user