mirror of
https://github.com/ArthurDanjou/ArtStudies.git
synced 2026-01-14 13:54:06 +01:00
Refactor code formatting and improve readability in Jupyter notebooks for TP_4 and TP_5
- Adjusted indentation and line breaks for better clarity in function definitions and import statements. - Standardized string quotes for consistency across the codebase. - Enhanced readability of DataFrame creation and manipulation by breaking long lines into multiple lines. - Cleaned up print statements and comments for improved understanding. - Ensured consistent use of whitespace around operators and after commas.
This commit is contained in:
@@ -715,10 +715,7 @@
|
||||
" I_exact = 2 / (k + 1) if k % 2 == 0 else 0\n",
|
||||
" approx_error = np.abs(I_approx - I_exact)\n",
|
||||
" approx_errors.append(approx_error)\n",
|
||||
" print(\n",
|
||||
" f\"{N:5d} | \"\n",
|
||||
" + \" \".join(f\"{e:.3f} \" for e in approx_errors)\n",
|
||||
" )"
|
||||
" print(f\"{N:5d} | \" + \" \".join(f\"{e:.3f} \" for e in approx_errors))"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -773,10 +770,7 @@
|
||||
" I_exact = 2 / (k + 1) if k % 2 == 0 else 0\n",
|
||||
" approx_error = np.abs(I_approx - I_exact)\n",
|
||||
" approx_errors.append(approx_error)\n",
|
||||
" print(\n",
|
||||
" f\"{N:5d} | \"\n",
|
||||
" + \" \".join(f\"{e:.3f} \" for e in approx_errors)\n",
|
||||
" )"
|
||||
" print(f\"{N:5d} | \" + \" \".join(f\"{e:.3f} \" for e in approx_errors))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -333,6 +333,8 @@
|
||||
"source": [
|
||||
"def f(x):\n",
|
||||
" return 1 / (1 + x**2)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"a, b = -5, 5\n",
|
||||
"xx = np.linspace(a, b, 200)\n",
|
||||
"\n",
|
||||
@@ -375,6 +377,8 @@
|
||||
"source": [
|
||||
"def f(x):\n",
|
||||
" return 1 / (1 + x**2)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"a, b = -5, 5\n",
|
||||
"xx = np.linspace(a, b, 200)\n",
|
||||
"\n",
|
||||
|
||||
@@ -65,12 +65,20 @@
|
||||
"source": [
|
||||
"def f1(x):\n",
|
||||
" return np.exp(x) - 1 - x\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def f2(x):\n",
|
||||
" return x - np.sin(x)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def f3(x):\n",
|
||||
" return x + np.sin(x)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def f4(x):\n",
|
||||
" return x + np.cos(x) - 1\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def f5(x):\n",
|
||||
" return x - np.cos(x) + 1"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user