physics/potential_well.ipynb

111 lines
332 KiB
Plaintext
Raw Normal View History

2022-11-19 22:41:30 +00:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib widget\n",
"from mpl_toolkits.mplot3d import Axes3D\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"# Mass of planet / kg\n",
"M = 5.974e24\n",
"# Radius of planet / m\n",
"R = 6.378e6\n",
"# Universal gravitational constant\n",
"G = 6.67e-11"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"x = np.linspace(-4 * R, 4 * R, 1000)\n",
"y = np.linspace(-4 * R, 4 * R, 1000)\n",
"\n",
"X, Y = np.meshgrid(x, y)\n",
"r = np.sqrt(X**2 + Y**2)\n",
"r[r < R] = np.NaN\n",
"V = -G * M / r"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bcd3de785fd043ab9ae1efba1f559a2e",
"version_major": 2,
"version_minor": 0
},
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9V6wkeXrmB//+JtIef8pXd7WbNmM4M5zhkhouqSUhfMIKEnYFOUC6IiADSBR0IQmQxJsVoAsZLLQCpAtKN7xY6EYCFoIIfB92ueSS3PGmp2emva0u744/edLE33wX7z8iIzKzuqu6y3bFAxx0V2T4kyfjyed9n+dVMcZIgwYNGjRo0KBBgycG+mGfQIMGDRo0aNCgQYMHi4YANmjQoEGDBg0aPGFoCGCDBg0aNGjQoMEThoYANmjQoEGDBg0aPGFoCGCDBg0aNGjQoMEThoYANmjQoEGDBg0aPGFoCGCD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IYhQJYtUgUhy8Yl6RQnsUrZg3nqT4w899w6IUTyfECed4jRzO3rUcL9nt38SbgdIXTOked5jRBW5xjfaU9qgwYNHi00BLBBg0cA96LkO4vqg/zu9xWwdgDMOn7FiSuKX4ZSvty39JdR9vCFoBMhi6kPcEoYqyRP+gHnVboYA1k2ToqgLSNhvJ+ST60jWuepH9Gm86nvR6mItWNarQHOtZlMeoSQ3eX9ePJwp4RQKUWr1ar1EDZo0ODRR0MAGzR4yKiqfveyvFbspygl3zkiWbaH1o4QTCJvxdxahdaTpLBNiBHy3GBtUcadzm7TOqB1wDmZ/bvosmJ0WJvjvSVGUwZFC8kbA9MeQVENDVov2peYRbTOca6V8gflnIf
"text/html": [
"\n",
" <div style=\"display: inline-block;\">\n",
" <div class=\"jupyter-widgets widget-label\" style=\"text-align: center;\">\n",
" Figure\n",
" </div>\n",
" <img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOz9V6wkeXrmB//+JtIef8pXd7WbNmM4M5zhkhouqSUhfMIKEnYFOUC6IiADSBR0IQmQxJsVoAsZLLQCpAtKN7xY6EYCFoIIfB92ueSS3PGmp2emva0u744/edLE33wX7z8iIzKzuqu6y3bFAxx0V2T4kyfjyed9n+dVMcZIgwYNGjRo0KBBgycG+mGfQIMGDRo0aNCgQYMHi4YANmjQoEGDBg0aPGFoCGCDBg0aNGjQoMEThoYANmjQoEGDBg0aPGFoCGCDBg0aNGjQoMEThoYANmjQoEGDBg0aPGFoCGCDBg0aNGjQoMEThoYANmjQoEGDBg0aPGFoCGCDBg0aNGjQoMEThoYANmjQoEGDBg0aPGFoCGCDBg0aNGjQoMEThoYANmjQoEGDBg0aPGFoCGCDBg0aNGjQoMEThoYAN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uKX4ZSvty39JdR9vCFoBMhi6kPcEoYqyRP+gHnVboYA1k2ToqgLSNhvJ+ST60jWuepH9Gm86nvR6mItWNarQHOtZlMeoSQ3eX9ePJwp4RQKUWr1ar1EDZo0ODRR0MAGzR4yKiqfveyvFbspygl3zkiWbaH1o4QTCJvxdxahdaTpLBNiBHy3GBtUcadzm7TOqB1wDmZ/bvosmJ0WJvjvSVGUwZ
" </div>\n",
" "
],
"text/plain": [
"Canvas(toolbar=Toolbar(toolitems=[('Home', 'Reset original view', 'home', 'home'), ('Back', 'Back to previous …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig = plt.figure()\n",
"\n",
"ax = Axes3D(fig, auto_add_to_figure=False)\n",
"ax.plot_surface(X, Y, V, cmap=plt.cm.hot)\n",
"ax.set_xlabel(\"x\")\n",
"ax.set_ylabel(\"y\")\n",
"ax.set_zlabel(\"V\")\n",
"ax.set_title(\"Potential Well\")\n",
"\n",
"fig.add_axes(ax)\n",
"plt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.9.2 64-bit",
"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.9.2 (default, Feb 28 2021, 17:03:44) \n[GCC 10.2.1 20210110]"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}