Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168695
Image: ubuntu2004
'Vektory'
'Vektory'
u = vector([2, -1, 0]) #definice vektoru v = vector([-1, 5, 3]) u; v
(2, -1, 0) (-1, 5, 3)
u + v #scitani vektoru
(1, 4, 3)
u*v #nasobeni vektoru
-7
3*u - 2*v #linearni kombinace
(8, -13, -6)
'Matice'
'Matice'
A = matrix([[1, -6, 4, 0], [-4, 3, 8, 7]]) #definice matice A
[ 1 -6 4 0] [-4 3 8 7]
B = matrix([[2, -5], [3, 4], [-7, 1], [-2, 8]]) B
[ 2 -5] [ 3 4] [-7 1] [-2 8]
A*B #nasobeni matic
[-44 -25] [-69 96]
B*A
[ 22 -27 -32 -35] [-13 -6 44 28] [-11 45 -20 7] [-34 36 56 56]
transpose(A) #vypocet transponovane matice
[ 1 -4] [-6 3] [ 4 8] [ 0 7]
rank(A) #hodnost matice
2
rank(B*A)
2
det(A*B) #vypocet determinantu matice
-5949
'Reseni rovnic a jejich soustav'
'Reseni rovnic a jejich soustav'
solve(x^2 + 4*x - 2 == 0, x) #reseni jednoduche rovnice
[x == -sqrt(6) - 2, x == sqrt(6) - 2]
x, y = var('x, y') solve([x - y == 2, x + y == 10], [x, y]) #reseni soustavy rovnic
[[x == 6, y == 4]]
solve(sin(x) == 1, x) #Sage nevrati vzdy vsechna reseni
[x == 1/2*pi]
p = solve(x^2 + 4*x == 2, x, solution_dict = True); p
[{x: -sqrt(6) - 2}, {x: sqrt(6) - 2}]
for sol in p: print(n(sol[x], digits = 3)) #numericka aproxiamce reseni
-4.45 0.449