mirror of
https://github.com/ArthurDanjou/ArtStudies.git
synced 2026-01-27 20:55:24 +01:00
Refactor code for improved readability and consistency across multiple Jupyter notebooks
- Added missing commas in various print statements and function calls for better syntax. - Reformatted code to enhance clarity, including breaking long lines and aligning parameters. - Updated function signatures to use float type for sigma parameters instead of int for better precision. - Cleaned up comments and documentation strings for clarity and consistency. - Ensured consistent formatting in plotting functions and data handling.
This commit is contained in:
@@ -682,7 +682,7 @@
|
||||
" [\n",
|
||||
" (F(x + delta * e(i, d)) - F(x - delta * e(i, d))) / (2 * delta)\n",
|
||||
" for i in range(d)\n",
|
||||
" ]\n",
|
||||
" ],\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
"\n",
|
||||
|
||||
@@ -384,7 +384,7 @@
|
||||
"optimal_point_newton, iterations_newton = newton_method(initial_guess_newton)\n",
|
||||
"print(f\"Optimal point (Newton): {optimal_point_newton}\")\n",
|
||||
"print(\n",
|
||||
" f\"Objective function value at optimal point (Newton): {objective_function(optimal_point_newton)}\"\n",
|
||||
" f\"Objective function value at optimal point (Newton): {objective_function(optimal_point_newton)}\",\n",
|
||||
")\n",
|
||||
"print(f\"Number of iterations (Newton): {iterations_newton}\")\n",
|
||||
"\n",
|
||||
@@ -395,7 +395,7 @@
|
||||
"optimal_point_dichotomy, iterations_dichotomy = dichotomy_method(aL, aR)\n",
|
||||
"print(f\"Optimal point (Dichotomy): {optimal_point_dichotomy}\")\n",
|
||||
"print(\n",
|
||||
" f\"Objective function value at optimal point (Dichotomy): {objective_function(optimal_point_dichotomy)}\"\n",
|
||||
" f\"Objective function value at optimal point (Dichotomy): {objective_function(optimal_point_dichotomy)}\",\n",
|
||||
")\n",
|
||||
"print(f\"Number of iterations (Dichotomy): {iterations_dichotomy}\")"
|
||||
]
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"def generate_thetas(n):\n",
|
||||
" random_steps = np.random.random(n)\n",
|
||||
" return np.concatenate(\n",
|
||||
" ([0], np.cumsum(random_steps / np.sum(random_steps) * (2 * np.pi)))\n",
|
||||
" ([0], np.cumsum(random_steps / np.sum(random_steps) * (2 * np.pi))),\n",
|
||||
" )\n",
|
||||
"\n",
|
||||
"\n",
|
||||
|
||||
Reference in New Issue
Block a user