Skip to content

Instantly share code, notes, and snippets.

@pjpmarques
Last active August 29, 2015 14:10
Show Gist options
  • Save pjpmarques/f373ef10c4b82fe49439 to your computer and use it in GitHub Desktop.
Save pjpmarques/f373ef10c4b82fe49439 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:1eefae80118eddd6e16c9729ac1e1b82eb8c72e81be615678cef3b6817697084"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from sympy import *"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"x, y, z = symbols('x y z')"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"expr = -0.5*(x**2 + y**2 + z**2) - 0.5 * (1. / sqrt(0.5 + x**2 + y**2 + z**2))"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"expr"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 5,
"text": [
"-0.5*x**2 - 0.5*y**2 - 0.5*z**2 - 0.5/sqrt(x**2 + y**2 + z**2 + 0.5)"
]
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"solve(expr, z)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"text": [
"[0.998447168667795*sqrt((-0.5 + 5.55111512312578e-17*I)*(x**2*(1.50466936728937 - 0.868721264245904*I) + x**2*(0.501556455763125 + 0.868721264245904*I) + y**2*(1.50466936728937 - 0.868721264245904*I) + y**2*(0.501556455763125 + 0.868721264245904*I) - 1.72153100245073 + 2.77555756156289e-17*I)),\n",
" 0.998447168667795*sqrt((-0.25 - 0.433012701892219*I)*(x**2*(-0.501556455763125 - 0.868721264245904*I) + x**2*(1.50466936728937 - 0.868721264245904*I) + y**2*(-0.501556455763125 - 0.868721264245904*I) + y**2*(1.50466936728937 - 0.868721264245904*I) + 2.13923449877463 - 0.337986283453217*I)),\n",
" -0.998447168667795*sqrt(0.25 + 0.433012701892219*I)*sqrt(x**2*(-1.50466936728937 + 0.868721264245904*I) + x**2*(0.501556455763125 + 0.868721264245904*I) + y**2*(-1.50466936728937 + 0.868721264245904*I) + y**2*(0.501556455763125 + 0.868721264245904*I) - 2.13923449877463 + 0.337986283453217*I),\n",
" -0.998447168667795*sqrt((0.5 - 5.55111512312578e-17*I)*(x**2*(-0.501556455763125 - 0.868721264245904*I) + x**2*(-1.50466936728937 + 0.868721264245904*I) + y**2*(-0.501556455763125 - 0.868721264245904*I) + y**2*(-1.50466936728937 + 0.868721264245904*I) + 1.72153100245073 - 2.77555756156289e-17*I)),\n",
" -0.407614349727112*(0.5 + 0.866025403784439*I)*sqrt(x**2*(3.00933873457875 + 5.21232758547543*I) + y**2*(3.00933873457875 + 5.21232758547543*I) + 6.4177034963239 + 1.01395885035965*I),\n",
" 0.407614349727112*(0.5 + 0.866025403784439*I)*sqrt(x**2*(3.00933873457875 + 5.21232758547543*I) + y**2*(3.00933873457875 + 5.21232758547543*I) + 6.4177034963239 + 1.01395885035965*I)]"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment