isra@linuxmint ~ $ python Python 2.7.4 (default, Sep 26 2013, 03:20:56) [GCC 4.7.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from sympy import Matrix >>> Matrix([[1,2,3],[4,6,7]]) [1, 2, 3] [4, 6, 7] >>> A=Matrix([[1,2,3],[4,6,7]]) >>> b=3 >>> c = b*A >>> c [ 3, 6, 9] [12, 18, 21] >>> >>> x=Symbol('x') >>> y=Symbol('y') >>> H = Matrix([[x+y,4],[3,x-y]]) >>> H [x + y, 4] [ 3, x - y] >>> h = H*H >>> h [(x + y)**2 + 12, 8*x] [ 6*x, (x - y)**2 + 12] >>> #matris identidad ... >>> eye(4) [1, 0, 0, 0] [0, 1, 0, 0] [0, 0, 1, 0] [0, 0, 0, 1] >>> #matris ceros ... >>> zeros(4) [0, 0, 0, 0] [0, 0, 0, 0] [0, 0, 0, 0] [0, 0, 0, 0] >>> #matris unos ... >>> ones(5,6) [1, 1, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1] >>> v1 = Matrix([1,2,3]) >>> v2 = Matrix([5,7,8]) >>> v3 = v1.cross(v2) >>> v3 [-5, 7, -3] >>> #producto punto ... >>> v4 = v1.dot(v2) >>> v4 43
videotutoriales de matlab, octave, numpy, python, POA, algoritmia, simulacion de procesos en ingenieria quimica, y algo de ingenieria quimica
miércoles, 23 de abril de 2014
Operación con matrices usando Sympy-Python
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario