diff --git a/SR/buried_2d_dipoles.ipynb b/SR/buried_2d_dipoles.ipynb new file mode 100644 index 0000000..94a41b4 --- /dev/null +++ b/SR/buried_2d_dipoles.ipynb @@ -0,0 +1,143 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Preamble\n", + "from sympy import * \n", + "from sympy.vector import *\n", + "init_printing() # gives latex formatted output" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "N = vector.CoordSys3D(\"\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "moment_vec = 0 * N.i + 1 * N.j + 0 * N.k" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "x0,y0,z0 = symbols(\"x0, y0, z0\") # declare some symbols associated with coordinate translation\n", + "N.z = 0 # reduce to 2d\n", + "z0 = 0 # reduce to 2d\n", + "position_vec = (N.x - x0) * N.i + (N.y - y0) * N.j + (N.z -z0) * N.k" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "position_abs = sqrt(position_vec.dot(position_vec))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "surface = 1 / position_abs # In 3d should have surface area of sphere (don't need factors of 4pi), something like 1/rabs^2.\n", + " # In 2d you drop a factgor of r so associate it with the side area of a cylinder of unit height??? seems to work" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Flux function associated with such a dipole\n", + "A_dip_vec = surface * moment_vec.cross(position_vec) / position_abs\n", + "A_dip_vec " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Magnetic field associated with such a dipole \n", + "B_dip_vec = curl(A_dip_vec)\n", + "B_dip_vec" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Plot the field - unfortunately this isn't the one-liner it would be in Maple but at least its free\n", + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "\n", + "# Do this later\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.7.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}