![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/local/lib/python3.6/dist-packages/sympy/parsing/autolev/test-examples/ |
Upload File : |
import sympy.physics.mechanics as me import sympy as sm import math as m import numpy as np q1, q2 = me.dynamicsymbols('q1 q2') x, y, z = me.dynamicsymbols('x y z') e = q1+q2 a = (e).subs({q1:x**2+y**2, q2:x-y}) e2 = sm.cos(x) e3 = sm.cos(x*y) a = (e2).series(x, 0, 2).removeO() b = (e3).series(x, 0, 2).removeO().series(y, 0, 2).removeO() e = ((x+y)**2).expand() a = (e).subs({q1:x**2+y**2,q2:x-y}).subs({x:1,y:z}) bm = sm.Matrix([i.subs({x:1,y:z}) for i in sm.Matrix([e,2*e]).reshape(2, 1)]).reshape((sm.Matrix([e,2*e]).reshape(2, 1)).shape[0], (sm.Matrix([e,2*e]).reshape(2, 1)).shape[1]) e = q1+q2 a = (e).subs({q1:x**2+y**2,q2:x-y}).subs({x:2,y:z**2}) j, k, l = sm.symbols('j k l', real=True) p1 = sm.Poly(sm.Matrix([j,k,l]).reshape(1, 3), x) p2 = sm.Poly(j*x+k, x) root1 = [i.evalf() for i in sm.solve(p1, x)] root2 = [i.evalf() for i in sm.solve(sm.Poly(sm.Matrix([1,2,3]).reshape(3, 1), x),x)] m = sm.Matrix([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]).reshape(4, 4) am = (m).T+m bm = sm.Matrix([i.evalf() for i in (m).eigenvals().keys()]) c1 = sm.diag(1,1,1,1) c2 = sm.Matrix([2 if i==j else 0 for i in range(3) for j in range(4)]).reshape(3, 4) dm = (m+c1)**(-1) e = (m+c1).det()+(sm.Matrix([1,0,0,1]).reshape(2, 2)).trace() f = (m)[1,2] a = (m).cols bm = (m).col(0) cm = sm.Matrix([(m).T.row(0),(m).T.row(1),(m).T.row(2),(m).T.row(3),(m).T.row(2)]) dm = (m).row(0) em = sm.Matrix([(m).row(0),(m).row(1),(m).row(2),(m).row(3),(m).row(2)])