Created
December 15, 2013 15:59
-
-
Save moorepants/7974682 to your computer and use it in GitHub Desktop.
New behavior of IPython printing for PR 2683
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": [ | |
"import sympy" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 1 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"sympy.__version__" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 2, | |
"text": [ | |
"'0.7.4-git'" | |
] | |
} | |
], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"d = {'Something Funny': 0.0, '\\pi * \\cos{\\alpha': 1.0}" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 3 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"alpha, beta, gamma = sympy.symbols('alpha, beta, gamma')" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 4 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"sympy.init_printing()" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 5 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"It used to render string types with LaTeX, but now that is removed so this dictionary now comes out as plain text." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"d" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 6, | |
"text": [ | |
"{'Something Funny': 0.0, '\\\\pi * \\\\cos{\\x07lpha': 1.0}" | |
] | |
} | |
], | |
"prompt_number": 6 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"{alpha: 1, beta: gamma, gamma:0.0}" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"$$\\begin{Bmatrix}\\alpha : 1, & \\beta : \\gamma, & \\gamma : 0.0\\end{Bmatrix}$$" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"png": "iVBORw0KGgoAAAANSUhEUgAAANQAAAAaBAMAAAA9Em/vAAAAMFBMVEX///8AAAAAAAAAAAAAAAAA\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAAD3RSTlMAMolUmc0idhCru+9m\n3URozekSAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACtElEQVRIDbVVQWgTQRR92Ww3m3QTA57FpVYr\nSG0uihdpEHrwojkIongI4sWDWKQ9iEIHrxUMnvQgBuxBT1rBgicXT4UqehLaS1MQDyoURUE9+f/f\n2d1JNlloIR8y77/3/8zLzM4mAHIHMPT4XBWLmebQneBcZI/Cn+E7AaM+uRQbfaxGVEp0bo+ntAzB\nPTUnh6axxC79rJznKrXKZXj1lDhYGKm5n7iqUVz6WLlLj1VqER+VjylxsLAGHOSqxkFWwILqXSTf\nhN3uFTP4M2BaUV3jTqwKwDc5/IzlzdJfYLtGgkbDanyuI43llkB6V3uvzMvZY50b8ptPkVfSGg8n\n/ymcYMYd7i+ymk1QrEptqlzruCsOf4nFBg39DnD1zvgyV9xXPK7d3wDt0wzv9WQbtHjY4fwE9vtA\nhGK1yOWXwFJBUaIjvSvqmo+qcFqwO8djKslV4Ey+GWmRRYQevb3OOaralMxYURthX6vtuMFTgO/H\nVJJVwEqWcGlXcoAaMVnF+yY1jraBI4dlRjikrHJVubdGy1FSesLaSgR6VtM1ohG655G/RPyeD0xx\nIYqUFT+Yh1FVcKyLCbH8RNsAPiiiER4LgOtksYdwivQ4UlYlOuqVuMzJRBcTYs0m2i16JMw0Vn5Q\nzjfQbsE7m1PEkhvo/iYaRzHAvg6z8AZS8oAOo8FKEkXFedhRrrnL3CCof/7kGo69C2z5muF7dfrN\neoBNmciTKbbe3tDPUt4rUupAmW6TGXZIpMOduFkFrSZoWpkTorzSjDJC42i0Wif8onMN2qpbDJnx\na9Gn7JmabxLOKwEN/DHiu5H3pNlWd83u1K6sJj2VwGwBDnVTk2VbmetUquY8zvlt7do3cZ8+AyLb\nasCk3cnyL2y92N3knc0q17n/guJxyPFIsUH+yZBtaPmvwfA9DIf/nMWV83uwjJAAAAAASUVORK5C\nYII=\n", | |
"prompt_number": 7, | |
"text": [ | |
"{\u03b1: 1, \u03b2: \u03b3, \u03b3: 0.0}" | |
] | |
} | |
], | |
"prompt_number": 7 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"sympy.init_printing(print_builtin=False)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 8 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"d" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 9, | |
"text": [ | |
"{'Something Funny': 0.0, '\\\\pi * \\\\cos{\\x07lpha': 1.0}" | |
] | |
} | |
], | |
"prompt_number": 9 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Dictionaries only render in LaTeX if all of their elements are SymPy types (including floats and integers). With the print_builtin flag False, the ints and floats will not render, thus the whole dict will not render." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"{alpha: 1, beta: gamma, gamma:0.0}" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 10, | |
"text": [ | |
"{beta: gamma, alpha: 1, gamma: 0.0}" | |
] | |
} | |
], | |
"prompt_number": 10 | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment