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:
2025-11-25 10:46:16 +01:00
parent 21e376de79
commit 8400c722a5
17 changed files with 11975 additions and 11713 deletions

View File

@@ -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))"
]
},
{

View File

@@ -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",

View File

@@ -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"
]