LUNAR
🌙
Dashboard
Browse
calculations
JUPYTER
View Source
{ "cells": [ { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "m: 5.1433962264150965\n", "300/m: 58.32721936903886\n" ] } ], "source": [ "import numpy as np\n", "from sklearn.linear_model import LinearRegression\n", "\n", "peak_area = np.array([50, 105, 260, 520, 1025])\n", "concentration = np.array([10, 20, 50, 100, 200])\n", "\n", "concentration = concentration.reshape(-1, 1)\n", "\n", "model = LinearRegression(fit_intercept=False)\n", "model.fit(concentration, peak_area)\n", "\n", "m = model.coef_[0]\n", "\n", "print(\"m:\", m)\n", "print(\"300/m:\", 300/m)" ] }, { "cell_type": "code", "execution_count": 56, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "slope: 5.143396226415095\n", "300/slope: 58.32721936903888\n" ] } ], "source": [ "import numpy as np\n", "\n", "x = np.array([10, 20, 50, 100, 200])\n", "y = np.array([50, 105, 260, 520, 1025])\n", "\n", "slope = np.sum(x * y) / np.sum(x**2)\n", "\n", "print(\"slope:\", slope)\n", "print(\"300/slope:\", 300/slope)\n" ] } ], "metadata": { "kernelspec": { "display_name": "base", "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.12.4" } }, "nbformat": 4, "nbformat_minor": 2 }