{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":117682,"databundleVersionId":15062069,"sourceType":"competition"}],"dockerImageVersionId":31239,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport matplotlib.pyplot as plt","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2026-01-09T15:05:30.084428Z","iopub.execute_input":"2026-01-09T15:05:30.084754Z","iopub.status.idle":"2026-01-09T15:05:30.101128Z","shell.execute_reply.started":"2026-01-09T15:05:30.084725Z","shell.execute_reply":"2026-01-09T15:05:30.097632Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"def generate_spiral(spiral_type=\"archimedean\", turns=5, points=1000):\n    \"\"\"\n    Generates x and y coordinates for various 2D spirals.\n    \n    Parameters:\n    - spiral_type: \"archimedean\", \"logarithmic\", or \"fermat\"\n    - turns: Number of full 360-degree rotations\n    - points: Number of points to calculate (higher = smoother curve)\n    \"\"\"\n    # t is our parameter, ranging from 0 to (turns * 2 * pi)\n    t = np.linspace(0, turns * 2 * np.pi, points)\n    \n    # Define the radius r(t) based on the spiral type\n    if spiral_type == \"archimedean\":\n        r = t\n    elif spiral_type == \"logarithmic\":\n        # a=1, b=0.17 for a classic seashell look\n        r = 1 * np.exp(0.17 * t)\n    elif spiral_type == \"fermat\":\n        r = np.sqrt(t)\n    else:\n        raise ValueError(\"Unknown spiral type selected.\")\n\n    # Convert polar coordinates (r, t) to Cartesian (x, y)\n    x = r * np.cos(t)\n    y = r * np.sin(t)\n    \n    return x, y","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-09T15:05:36.582241Z","iopub.execute_input":"2026-01-09T15:05:36.582562Z","iopub.status.idle":"2026-01-09T15:05:36.590162Z","shell.execute_reply.started":"2026-01-09T15:05:36.582537Z","shell.execute_reply":"2026-01-09T15:05:36.589380Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.figure(figsize=(6, 6))\n\n# Generate and plot\nx, y = generate_spiral(\"archimedean\", 20)\nplt.plot(x, y, label=\"Archimedean\")\n\nplt.title(\"2D Spiral Visualization\")\nplt.legend()\nplt.axis('equal')\nplt.grid(True)\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-09T15:08:31.232774Z","iopub.execute_input":"2026-01-09T15:08:31.233062Z","iopub.status.idle":"2026-01-09T15:08:31.433332Z","shell.execute_reply.started":"2026-01-09T15:08:31.233042Z","shell.execute_reply":"2026-01-09T15:08:31.432284Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.figure(figsize=(6, 6))\n\n# Generate and plot\nx, y = generate_spiral(\"logarithmic\", 10)\nplt.plot(x, y, label=\"logarithmic\")\n\nplt.title(\"2D Spiral Visualization\")\nplt.legend()\nplt.axis('equal')\nplt.grid(True)\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-09T15:09:36.683975Z","iopub.execute_input":"2026-01-09T15:09:36.684409Z","iopub.status.idle":"2026-01-09T15:09:36.902045Z","shell.execute_reply.started":"2026-01-09T15:09:36.684379Z","shell.execute_reply":"2026-01-09T15:09:36.901094Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"plt.figure(figsize=(6, 6))\n\n# Generate and plot\nx, y = generate_spiral(\"fermat\", 20)\nplt.plot(x, y, label=\"fermat\")\n\nplt.title(\"2D Spiral Visualization\")\nplt.legend()\nplt.axis('equal')\nplt.grid(True)\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-09T15:09:16.142704Z","iopub.execute_input":"2026-01-09T15:09:16.143660Z","iopub.status.idle":"2026-01-09T15:09:16.367877Z","shell.execute_reply.started":"2026-01-09T15:09:16.143614Z","shell.execute_reply":"2026-01-09T15:09:16.366835Z"}},"outputs":[],"execution_count":null}]}