CoCalc Shared Filesex_intro.sagews
Author: Susan Margulies
Views : 65
A = matrix([
[2,0,0,0,0,89],
[0,2,0,0,0,243],
[0,0,2,0,0,212],
[0,0,0,2,0,150],
[0,0,0,0,2,245],
[1,1,1,1,1,546]
])
#A
#type(A)
A.LLL()

[-1 1 -1 1 -1 0] [ 1 -1 -1 1 -1 -1] [-1 -1 -1 1 1 2] [ 1 -1 -1 -1 -1 2] [-2 -2 4 0 -2 0] [-6 -4 -6 -6 0 -3]
2 + 2
2*2
a = 2
b = 4
a*b
type(b)
p = "this is a string"
p
t = "r"
type(t)
t

4 4 8 <type 'sage.rings.integer.Integer'> 'this is a string' <type 'str'> 'r'
a = 3
b = 5
c = 0
if a > b:
c = 2*(a+b)
# indented in the if statement
elif a == b:
c = 3*(a + b)
else:
c = -2*(a+b)
# end if
# not indented not in the if statement
c

-16
# observe the upper bound
for i in range(1,7):
print "the value of i = " + str(i) + "and the value of i + 1 = " + str(i+1)

the value of i = 1and the value of i + 1 = 2 the value of i = 2and the value of i + 1 = 3 the value of i = 3and the value of i + 1 = 4 the value of i = 4and the value of i + 1 = 5 the value of i = 5and the value of i + 1 = 6 the value of i = 6and the value of i + 1 = 7
a = 0
while a <= 7:
a = a + 1
print a
print "I have exited the while loop"

1 2 3 4 5 6 7 8 I have exited the while loop
gcd(7, 26)
inverse_mod(7, 26)
mod(7*15, 26)

1 15 1
qe = ((-9.8)/2*x^2 + 250*sqrt(2)*x + 200 == 0)
qe
solve(qe, x)

-4.90000000000000*x^2 + 250*sqrt(2)*x + 200 == 0 [x == -10/49*sqrt(32230) + 1250/49*sqrt(2), x == 10/49*sqrt(32230) + 1250/49*sqrt(2)]
A = matrix([
[3,2],
[4,3]
])
A
B = matrix([
[3,1],
[7,2]
])
B
AB = A*B
print "AB = "
AB
AB.transpose()

print "B^T = "
B.transpose()
print "A^T = "
A.transpose()
B.transpose()*A.transpose()

[3 2] [4 3] [3 1] [7 2] AB = [23 7] [33 10] [23 33] [ 7 10] B^T = [3 7] [1 2] A^T = [3 4] [2 3] [23 33] [ 7 10]
|

v = vector([4*1,2,24*1^2])
u = vector([1,2,3*2^2])
v.dot_product(u)
500/15000.0
500*


296 0.0333333333333333