from sage.symbolic.integration.integral import indefinite_integral #A4.4a+b M3 = MatrixSpace(RR, 3) # Rational numbers print("Identity matrix:") show(M3.identity_matrix()) A = M3.matrix([[1, 0, 1], [-1, 0, 1], [ 1, 2, 1]]) print("Matrix A:") show(A) b=vector([2,0,2/3]) print("Vector b:") show(b) B=A.augment(b) show(B) C=B.rref() show(C) #A4.4c f(x)=exp(x) plot(f, -2,2) numerical_approx(f.integral(x, -2, 2)) #A4.4d M5= MatrixSpace(RR, 5) A = M5.matrix([[1, 0, 1, 0,2], [-1, 0, 1, 0,0], [1, 2, 1, 0,2/3], [-1,0, 1, 0,0],[1,0,1,24,2/5]]) show(A.rref())
Identity matrix:
1.000000000000000.0000000000000000.0000000000000000.0000000000000001.000000000000000.0000000000000000.0000000000000000.0000000000000001.00000000000000
Matrix A:
1.00000000000000−1.000000000000001.000000000000000.0000000000000000.0000000000000002.000000000000001.000000000000001.000000000000001.00000000000000
Vector b:
(2,0,32)
1.00000000000000−1.000000000000001.000000000000000.0000000000000000.0000000000000002.000000000000001.000000000000001.000000000000001.000000000000002.000000000000000.0000000000000000.666666666666667
1.000000000000000.0000000000000000.0000000000000000.0000000000000001.000000000000000.0000000000000000.0000000000000000.0000000000000001.000000000000001.00000000000000−0.6666666666666671.00000000000000
7.25372081569404
Identity matrix:
1.000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000001.000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000001.000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000001.000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000001.00000000000000
1.000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000001.000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000001.000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000000.0000000000000001.000000000000000.0000000000000001.00000000000000−0.6666666666666671.00000000000000−0.06666666666666670.000000000000000