mirror of
https://github.com/ArthurDanjou/ArtStudies.git
synced 2026-01-28 00:55:23 +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:
@@ -66,6 +66,8 @@
|
||||
"\n",
|
||||
"def f(x):\n",
|
||||
" return np.tanh(x)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"aL, aR = -20, 3\n",
|
||||
"print(dichotomy(f, aL, aR))"
|
||||
]
|
||||
@@ -135,9 +137,15 @@
|
||||
"\n",
|
||||
"def f(x):\n",
|
||||
" return np.log(np.exp(x) + np.exp(-x))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"x0 = 1.8\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def df(x):\n",
|
||||
" return (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"print(Newton(f, df, x0))"
|
||||
]
|
||||
},
|
||||
@@ -188,6 +196,8 @@
|
||||
"\n",
|
||||
"def f(x):\n",
|
||||
" return np.log(np.exp(x) + np.exp(-x))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"xx = [(1, 1.9), (1, 2.3), (1, 2.4)]\n",
|
||||
"\n",
|
||||
"for x0, x1 in xx:\n",
|
||||
@@ -265,8 +275,12 @@
|
||||
"\n",
|
||||
"def f(x):\n",
|
||||
" return np.log(np.exp(x) + np.exp(-x))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def df(x):\n",
|
||||
" return (np.exp(x) - np.exp(-x)) / (np.exp(x) + np.exp(-x))\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"print(DichotomyNewton(f, df, -20, 3))"
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user