Commit 4eab1d6a authored by Wenchao Zhang's avatar Wenchao Zhang ✍️
Browse files

add a solution for M^2=I

parent 83cd4f53
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
%% Cell type:code id: tags:

``` python
``` 
from sympy import *
x = symbols ('x')
f = symbols('f', cls=Function)
dsolve(f(x).diff(x)- cos(f(x)), f(x))
```

%% Output

    [Eq(f(x), pi - asin(1/tanh(C1 + x))), Eq(f(x), asin(1/tanh(C1 + x)))]

%% Cell type:code id: tags:

``` python
``` 
# 计算所有满足 M^2=I 的整系数矩阵, 无法使用这一方法计算 M^3
from sympy import *
a, b, c, d = symbols('a b c d');
M=Matrix([[a,b],[c,d]]);
K=M*M
N=Matrix([[1,0],[0,1]]);
solve(Eq(K,N),(a,b,c,d))
```

%% Output

    [(-1, 0, 0, -1),
     (-1, 0, 0, 1),
     (1, 0, 0, -1),
     (1, 0, 0, 1),
     (-d, (1 - d**2)/c, c, d)]

%% Cell type:code id: tags:

``` 
```