Created
January 29, 2014 21:57
-
-
Save moorepants/8697989 to your computer and use it in GitHub Desktop.
Show's vector printing on Windows for sympy in the notebook.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "metadata": { | |
| "name": "" | |
| }, | |
| "nbformat": 3, | |
| "nbformat_minor": 0, | |
| "worksheets": [ | |
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "from sympy import *\n", | |
| "from sympy.physics.mechanics import *" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 1 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "import sys" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 2 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "sys.path" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 3, | |
| "text": [ | |
| "['',\n", | |
| " 'c:\\\\documents and settings\\\\jason moore\\\\my documents\\\\src\\\\sympy',\n", | |
| " 'C:\\\\Anaconda\\\\envs\\\\sympy-test\\\\python27.zip',\n", | |
| " 'C:\\\\Anaconda\\\\envs\\\\sympy-test\\\\DLLs',\n", | |
| " 'C:\\\\Anaconda\\\\envs\\\\sympy-test\\\\lib',\n", | |
| " 'C:\\\\Anaconda\\\\envs\\\\sympy-test\\\\lib\\\\plat-win',\n", | |
| " 'C:\\\\Anaconda\\\\envs\\\\sympy-test\\\\lib\\\\lib-tk',\n", | |
| " 'C:\\\\Anaconda\\\\envs\\\\sympy-test',\n", | |
| " 'C:\\\\Anaconda\\\\envs\\\\sympy-test\\\\lib\\\\site-packages',\n", | |
| " 'C:\\\\Anaconda\\\\envs\\\\sympy-test\\\\lib\\\\site-packages\\\\setuptools-2.1-py2.7.egg',\n", | |
| " 'C:\\\\Anaconda\\\\envs\\\\sympy-test\\\\lib\\\\site-packages\\\\IPython\\\\extensions']" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 3 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "R = ReferenceFrame('R')" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 4 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "a = dynamicsymbols('a')" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 5 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "b = symbols('b')" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 6 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "v = a * R.x" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 7 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "v" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 8, | |
| "text": [ | |
| "a*R.x" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 8 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "w = b * R.x" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 9 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "w" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 10, | |
| "text": [ | |
| "b*R.x" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 10 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "latex(v)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 11, | |
| "text": [ | |
| "'a\\\\mathbf{\\\\hat{r}_x}'" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 11 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "latex(w)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 12, | |
| "text": [ | |
| "'b\\\\mathbf{\\\\hat{r}_x}'" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 12 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "init_printing()" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 13 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "v" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "latex": [ | |
| "$$a\\mathbf{\\hat{r}_x}$$" | |
| ], | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 14, | |
| "text": [ | |
| "a*\u001b[94m\u001b[1mr_x\u001b[0;0m\u001b[0;0m" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 14 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "w" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "latex": [ | |
| "$$b\\mathbf{\\hat{r}_x}$$" | |
| ], | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 15, | |
| "text": [ | |
| "b*\u001b[94m\u001b[1mr_x\u001b[0;0m\u001b[0;0m" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 15 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "latex(v)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 16, | |
| "text": [ | |
| "'a\\\\mathbf{\\\\hat{r}_x}'" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 16 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "latex(w)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 17, | |
| "text": [ | |
| "'b\\\\mathbf{\\\\hat{r}_x}'" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 17 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "latex(a)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 18, | |
| "text": [ | |
| "'a{\\\\left (t \\\\right )}'" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 18 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "latex(b)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 19, | |
| "text": [ | |
| "'b'" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 19 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "a" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "latex": [ | |
| "$$a{\\left (t \\right )}$$" | |
| ], | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 20, | |
| "text": [ | |
| "a(t)" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 20 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "b" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "latex": [ | |
| "$$b$$" | |
| ], | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 21, | |
| "text": [ | |
| "b" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 21 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "init_printing(use_latex='png')" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 22 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "v" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 23, | |
| "text": [ | |
| "a*\u001b[94m\u001b[1mr_x\u001b[0;0m\u001b[0;0m" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 23 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "w" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 24, | |
| "text": [ | |
| "b*\u001b[94m\u001b[1mr_x\u001b[0;0m\u001b[0;0m" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 24 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "latex(v)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 25, | |
| "text": [ | |
| "'a\\\\mathbf{\\\\hat{r}_x}'" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 25 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "latex(w)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 26, | |
| "text": [ | |
| "'b\\\\mathbf{\\\\hat{r}_x}'" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 26 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "a" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 27, | |
| "text": [ | |
| "a(t)" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 27 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "b" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 28, | |
| "text": [ | |
| "b" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 28 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "%install_ext http://raw.github.com/jrjohansson/version_information/master/version_information.py" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| "Installed version_information.py. To use it, type:\n", | |
| " %load_ext version_information\n" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 29 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "%load_ext version_information" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 30 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "%version_information sympy" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "html": [ | |
| "<table><tr><th>Software</th><th>Version</th></tr><tr><td>Python</td><td>2.7.6 |Continuum Analytics, Inc.| (default, Nov 11 2013, 10:50:31) [MSC v.1500 32 bit (Intel)]</td></tr><tr><td>IPython</td><td>1.1.0</td></tr><tr><td>OS</td><td>nt [win32]</td></tr><tr><td>sympy</td><td>0.7.4.1-git</td></tr><tr><td colspan='2'>Wed Jan 29 16:47:43 2014 Eastern Standard Time</td></tr></table>" | |
| ], | |
| "json": [ | |
| "{\"Software versions\": [{\"version\": \"2.7.6 |Continuum Analytics, Inc.| (default, Nov 11 2013, 10:50:31) [MSC v.1500 32 bit (Intel)]\", \"module\": \"Python\"}, {\"version\": \"1.1.0\", \"module\": \"IPython\"}, {\"version\": \"nt [win32]\", \"module\": \"OS\"}, {\"version\": \"0.7.4.1-git\", \"module\": \"sympy\"}]}" | |
| ], | |
| "latex": [ | |
| "\\begin{tabular}{|l|l|}\\hline\n", | |
| "{\\bf Software} & {\\bf Version} \\\\ \\hline\\hline\n", | |
| "Python & 2.7.6 |Continuum Analytics, Inc.| (default, Nov 11 2013, 10:50:31) [MSC v.1500 32 bit (Intel)] \\\\ \\hline\n", | |
| "IPython & 1.1.0 \\\\ \\hline\n", | |
| "OS & nt [win32] \\\\ \\hline\n", | |
| "sympy & 0.7.4.1-git \\\\ \\hline\n", | |
| "\\hline \\multicolumn{2}{|l|}{Wed Jan 29 16:47:43 2014 Eastern Standard Time} \\\\ \\hline\n", | |
| "\\end{tabular}\n" | |
| ], | |
| "metadata": {}, | |
| "output_type": "pyout", | |
| "prompt_number": 31, | |
| "text": [ | |
| "Software versions\n", | |
| "Python 2.7.6 |Continuum Analytics, Inc.| (default, Nov 11 2013, 10:50:31) [MSC v.1500 32 bit (Intel)]\n", | |
| "IPython 1.1.0\n", | |
| "OS nt [win32]\n", | |
| "sympy 0.7.4.1-git\n", | |
| "\n", | |
| "Wed Jan 29 16:47:43 2014 Eastern Standard Time" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 31 | |
| } | |
| ], | |
| "metadata": {} | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment