# Równania liniowe

## 2473 days ago by Henryk

A = matrix(SR,[[1,-2],[5,1]]) # to jest macierz z zadania 4 t = var('t') # szukamy rozwiązania x(y),y(t) x = function('x',t) y = function('y',t) C_1 = var('C_1') C_2 = var('C_2') S_1 = A.right_eigenmatrix()[1] S = matrix(SR,[[-I*sqrt(2/5),I*sqrt(2/5)],[1,1]]) # S to jest macierz wektorów własnych S_1; S; A
 ```[ 1 1] [ 1/2*I*sqrt(10) -1/2*I*sqrt(10)] [-I*sqrt(2/5) I*sqrt(2/5)] [ 1 1] [ 1 -2] [ 5 1]```
S_inverse = S.inverse(); S_inverse
 ```[ 5/4*I*sqrt(2/5) 1/2] [-5/4*I*sqrt(2/5) 1/2]```
S*S_inverse
 ```[1 0] [0 1]```
D = S_inverse*A*S; D; matrix(CDF,D)
 ```[ 1/4*I*(-5*I*sqrt(2/5) - 10)*sqrt(2/5) - 5/2*I*sqrt(2/5) + 1/2 -1/4*I*(-5*I*sqrt(2/5) - 10)*sqrt(2/5) - 5/2*I*sqrt(2/5) + 1/2] [ 1/4*I*(5*I*sqrt(2/5) - 10)*sqrt(2/5) + 5/2*I*sqrt(2/5) + 1/2 -1/4*I*(5*I*sqrt(2/5) - 10)*sqrt(2/5) + 5/2*I*sqrt(2/5) + 1/2] [1.0 - 3.16227766017*I 0] [ 0 1.0 + 3.16227766017*I]```
matrix(CDF,S*D*S_inverse)
 ```[ 1.0 -2.0] [ 5.0 1.0]```
D_1 = matrix(SR,[[exp(t*(1-I*sqrt(10))),0],[0,exp(t*(1+I*sqrt(10)))]]); D_1; (matrix(SR,[[C_1,C_2]])*S*D_1*S_inverse)
 ```[e^((-I*sqrt(10) + 1)*t) 0] [ 0 e^((I*sqrt(10) + 1)*t)] [5/4*I*(-I*sqrt(2/5)*C_1 + C_2)*sqrt(2/5)*e^((-I*sqrt(10) + 1)*t) - 5/4*I*(I*sqrt(2/5)*C_1 + C_2)*sqrt(2/5)*e^((I*sqrt(10) + 1)*t) 1/2*(-I*sqrt(2/5)*C_1 + C_2)*e^((-I*sqrt(10) + 1)*t) + 1/2*(I*sqrt(2/5)*C_1 + C_2)*e^((I*sqrt(10) + 1)*t)]```
x = 5/4*I*(-I*sqrt(2/5)*C_1 + C_2)*sqrt(2/5)*e^((-I*sqrt(10) + 1)*t) - 5/4*I*(I*sqrt(2/5)*C_1 + C_2)*sqrt(2/5)*e^((I*sqrt(10) + 1)*t) y = 1/2*(-I*sqrt(2/5)*C_1 + C_2)*e^((-I*sqrt(10) + 1)*t) + 1/2*(I*sqrt(2/5)*C_1 + C_2)*e^((I*sqrt(10) + 1)*t)
print (derivative(x,t)-x-5*y).simplify() print (derivative(y,t)+2*x-y).simplify()
 ```1/20*(-I*sqrt(10) + 1)*(sqrt(2)*sqrt(5)*C_1 + 5*I*C_2)*sqrt(2)*sqrt(5)*e^((-I*sqrt(10) + 1)*t) + 1/20*(I*sqrt(10) + 1)*(sqrt(2)*sqrt(5)*C_1 - 5*I*C_2)*sqrt(2)*sqrt(5)*e^((I*sqrt(10) + 1)*t) - 1/20*(sqrt(2)*sqrt(5)*C_1 - 5*I*C_2)*sqrt(2)*sqrt(5)*e^((I*sqrt(10) + 1)*t) - 1/20*(sqrt(2)*sqrt(5)*C_1 + 5*I*C_2)*sqrt(2)*sqrt(5)*e^((-I*sqrt(10) + 1)*t) - 1/2*(-I*sqrt(2)*sqrt(5)*C_1 + 5*C_2)*e^((-I*sqrt(10) + 1)*t) - 1/2*(I*sqrt(2)*sqrt(5)*C_1 + 5*C_2)*e^((I*sqrt(10) + 1)*t) 1/10*(-I*sqrt(10) + 1)*(-I*sqrt(2)*sqrt(5)*C_1 + 5*C_2)*e^((-I*sqrt(10) + 1)*t) + 1/10*(I*sqrt(10) + 1)*(I*sqrt(2)*sqrt(5)*C_1 + 5*C_2)*e^((I*sqrt(10) + 1)*t) + 1/10*(sqrt(2)*sqrt(5)*C_1 - 5*I*C_2)*sqrt(2)*sqrt(5)*e^((I*sqrt(10) + 1)*t) + 1/10*(sqrt(2)*sqrt(5)*C_1 + 5*I*C_2)*sqrt(2)*sqrt(5)*e^((-I*sqrt(10) + 1)*t) - 1/10*(-I*sqrt(2)*sqrt(5)*C_1 + 5*C_2)*e^((-I*sqrt(10) + 1)*t) - 1/10*(I*sqrt(2)*sqrt(5)*C_1 + 5*C_2)*e^((I*sqrt(10) + 1)*t)```
x = sqrt(5/2)*C_2*e^(t)*sin(sqrt(10)*t)+C_1*e^(t)*cos(sqrt(10)*t) y = C_2*e^(t)*cos(sqrt(10)*t)-sqrt(2/5)*C_1*e^(t)*sin(sqrt(10)*t) x; y
 ```sqrt(5/2)*C_2*e^t*sin(sqrt(10)*t) + C_1*e^t*cos(sqrt(10)*t) -sqrt(2/5)*C_1*e^t*sin(sqrt(10)*t) + C_2*e^t*cos(sqrt(10)*t)```
print (derivative(x,t)-x-5*y).simplify() print (derivative(y,t)+2*x-y).simplify()
 ```1/2*sqrt(2)*sqrt(5)*sqrt(10)*C_2*e^t*cos(sqrt(10)*t) + sqrt(2)*sqrt(5)*C_1*e^t*sin(sqrt(10)*t) - sqrt(10)*C_1*e^t*sin(sqrt(10)*t) - 5*C_2*e^t*cos(sqrt(10)*t) -1/5*sqrt(2)*sqrt(5)*sqrt(10)*C_1*e^t*cos(sqrt(10)*t) + sqrt(2)*sqrt(5)*C_2*e^t*sin(sqrt(10)*t) - sqrt(10)*C_2*e^t*sin(sqrt(10)*t) + 2*C_1*e^t*cos(sqrt(10)*t)```