{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from sympy import *" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "xi = DeferredVector(\"xi\")" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "Matrix([\n", "[ -xi[1] - xi[2] - xi[3] + 1],\n", "[ xi[1]],\n", "[ xi[2]],\n", "[ xi[3]],\n", "[4*xi[1]*(-xi[1] - xi[2] - xi[3] + 1)],\n", "[ 4*xi[1]*xi[2]],\n", "[4*xi[2]*(-xi[1] - xi[2] - xi[3] + 1)],\n", "[4*xi[3]*(-xi[1] - xi[2] - xi[3] + 1)],\n", "[ 4*xi[1]*xi[3]],\n", "[ 4*xi[2]*xi[3]]])" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def c3d10():\n", " N1 = 1 - xi[1] - xi[2] - xi[3]\n", " N2 = xi[1]\n", " N3 = xi[2]\n", " N4 = xi[3]\n", " N5 = 4*xi[1]*(1-xi[1]-xi[2]-xi[3])\n", " N6 = 4*xi[1]*xi[2]\n", " N7 = 4*xi[2]*(1-xi[1]-xi[2]-xi[3])\n", " N8 = 4*xi[3]*(1-xi[1]-xi[2]-xi[3])\n", " N9 = 4*xi[1]*xi[3]\n", " N10 = 4*xi[2]*xi[3]\n", " N = Matrix([N1, N2, N3, N4, N5, N6, N7, N8, N9, N10])\n", " dN = Matrix([N.diff(xi[1]).T, N.diff(xi[2]).T, N.diff(xi[3]).T]).T\n", " return N, dN\n", "\n", "N, dN = c3d10()\n", "N" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "Matrix([\n", "[ -1, -1, -1],\n", "[ 1, 0, 0],\n", "[ 0, 1, 0],\n", "[ 0, 0, 1],\n", "[-8*xi[1] - 4*xi[2] - 4*xi[3] + 4, -4*xi[1], -4*xi[1]],\n", "[ 4*xi[2], 4*xi[1], 0],\n", "[ -4*xi[2], -4*xi[1] - 8*xi[2] - 4*xi[3] + 4, -4*xi[2]],\n", "[ -4*xi[3], -4*xi[3], -4*xi[1] - 4*xi[2] - 8*xi[3] + 4],\n", "[ 4*xi[3], 0, 4*xi[1]],\n", "[ 0, 4*xi[3], 4*xi[2]]])" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dN" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "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.9" } }, "nbformat": 4, "nbformat_minor": 0 }