{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%display latex" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "N = Manifold(2, 'N',r'\\mathcal{N}', start_index=1)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "ChartCartesianN. = N.chart()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "FrameCartesianN = ChartCartesianN.frame()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "ChartPolarN. = N.chart(\"r:(0,+oo) theta:(0,2*pi)\")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "FramePolarN = ChartPolarN.frame()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "cartesianToPolar = ChartCartesianN.transition_map(ChartPolarN, (sqrt(x^2 + y^2), arctan(y/x)))" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Check of the inverse coordinate transformation:\n", " x == x\n", " y == y\n", " r == r\n", " theta == arctan(sin(theta)/cos(theta))\n" ] } ], "source": [ "cartesianToPolar.set_inverse(r * cos(theta), r * sin(theta), verbose=True)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": true }, "outputs": [], "source": [ "g_e = N.metric('g_e')" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": true }, "outputs": [], "source": [ "g_e[1,1], g_e[2,2] = 1, 1" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "g_e = dr*dr + (x^2 + y^2) dtheta*dtheta" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g_e.display(FramePolarN)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "g_e = dr*dr + r^2 dtheta*dtheta" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g_e.display(FramePolarN, ChartPolarN)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": true }, "outputs": [], "source": [ "nab_e = g_e.connection()" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Gam^r_theta,theta = -sqrt(x^2 + y^2) \n", "Gam^theta_r,theta = 1/sqrt(x^2 + y^2) \n", "Gam^theta_theta,r = 1/sqrt(x^2 + y^2) " ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nab_e.display(FramePolarN)" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Gam^r_theta,theta = -r \n", "Gam^theta_r,theta = 1/r \n", "Gam^theta_theta,r = 1/r " ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nab_e.display(FramePolarN, ChartPolarN)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SageMath 7.5", "language": "", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 0 }