{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "5bef2913-4855-471d-9594-5ec45c029048", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Length: 143.2 mm\n", "Freq: 2.822 Hz\n" ] } ], "source": [ "import math\n", "\n", "# Parameters\n", "spring_constant_n_mm = 1.1 * 4\n", "spring_length_resting_mm = 112\n", "\n", "def spring_length_at(weight):\n", " return weight * 9.81 / spring_constant_n_mm + spring_length_resting_mm\n", "\n", "def resonant_freq_at(weight):\n", " return 1 / (2 * math.pi) * math.sqrt(spring_constant_n_mm * 1000 / weight)\n", "\n", "# Environment\n", "weight_total_kg = 14\n", "\n", "print(f\"Length: {spring_length_at(weight_total_kg):.1f} mm\")\n", "print(f\"Freq: {resonant_freq_at(weight_total_kg):.3f} Hz\")" ] }, { "cell_type": "code", "execution_count": null, "id": "f21d84d9-c7a1-4fd2-aa32-136f04db32e5", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.3" } }, "nbformat": 4, "nbformat_minor": 5 }