Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168730
Image: ubuntu2004
a = var('a'); b = var('b'); c = var('c'); d = var('d'); v1=vector((a,b)); v2=vector((c,b)) m=matrix([v1,v2]); m; M = m*m*m; M;
[(a*b + b^2)*c + (a^2 + b*c)*a (a*b + b^2)*b + (a^2 + b*c)*b] [(b^2 + b*c)*c + (a*c + b*c)*a (b^2 + b*c)*b + (a*c + b*c)*b]
solve([M[0][0]==0, M[0][1]==0, M[1][0]==0, M[1][1]==0], a,b,c,d)
[[a == 0, b == 0, c == r28, d == r29], [a == r30, b == -r30, c == r30, d == r31]]
solve([(a*c+c*d)*(a*b+b*d) - (a*a+b*c)*(d*d+b*c) == 0],a,b,c,d)
([{a: b*c/d}], [2])
help(solve)
a,b,c,d,e,f,g,h,j,k,l,m,n,o,p,q,r = var('a,b,c,d,e,f,g,h,j,k,l,m,n,o,p,q,r') A = matrix([[a,b],[d,e]]) B = matrix([[j,k],[m,n]])
A*B
[a*j + b*m + c*p a*k + b*n + c*q a*l + b*o + c*r] [d*j + e*m + f*p d*k + e*n + f*q d*l + e*o + f*r] [g*j + h*m + I*p g*k + h*n + I*q g*l + h*o + I*r]
B*A
[a*j + d*k + g*l b*j + e*k + h*l c*j + f*k + I*l] [a*m + d*n + g*o b*m + e*n + h*o c*m + f*n + I*o] [a*p + d*q + g*r b*p + e*q + h*r c*p + f*q + I*r]
(A*B).eigenvalues()==(B*A).eigenvalues()
[a*d + 1/2*b^2 + 1/2*c^2 - 1/2*(b + c)*sqrt(4*a*d + b^2 - 2*b*c + c^2), a*d + 1/2*b^2 + 1/2*c^2 + 1/2*(b + c)*sqrt(4*a*d + b^2 - 2*b*c + c^2)]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "_sage_input_18.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("QSpC"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in <module> File "/tmp/tmpeM3h2w/___code___.py", line 2, in <module> exec compile(u'A*B' + '\n', '', 'single') File "", line 1, in <module> File "element.pyx", line 2467, in sage.structure.element.Matrix.__mul__ (sage/structure/element.c:16791) File "coerce.pyx", line 795, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:7489) TypeError: unsupported operand parent(s) for '*': 'Full MatrixSpace of 5 by 5 dense matrices over Real Double Field' and 'Full MatrixSpace of 2 by 2 dense matrices over Rational Field'