{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%display latex\n", "# %load_ext line_profiler # line by line profiling" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "S = manifolds.Sphere(stereo2d=True, stereo_lim=2)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "A = S.top_charts()[2] # spherical chart" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "t = var('t')" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "p = S((pi/2, 0.1), A)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "Tp = S.tangent_space(p)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "v = Tp((1, -1))" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "scrolled": false }, "outputs": [], "source": [ "c = S.integrated_geodesic(S.metric(), (t, 0, 4), v, across_charts=True)" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "scrolled": false }, "outputs": [], "source": [ "#%lprun -f c.solve_across_charts sol = c.solve_across_charts(step=0.02) # line by line profiling\n", "sol = c.solve_across_charts(step=0.02)" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "interp = c.interpolate()" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "P = c.plot_integrated(mapping=S.embedding(), color=[\"red\",\"green\",\"blue\",\"yellow\"], thickness=3, plot_points=100, across_charts=True)" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "P += A.plot(number_values=15, chart=S.ambient().default_chart(), mapping=S.embedding(), color='grey')" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n" ], "text/plain": [ "Graphics3d Object" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "P.show(viewer='threejs', online=True)" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Chart (A, (th, ph))\n", "Chart (U, (x, y))\n", "Chart (V, (xp, yp))\n", "Chart (U, (x, y))\n" ] } ], "source": [ "for inter in interp:\n", " print inter[0]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SageMath 8.3.rc1", "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.15" } }, "nbformat": 4, "nbformat_minor": 2 }