第一,這是我的代碼: module Problem1 = struct
type aexp =
| Const of int
| Var of string
| Power of string * int
| Times of aexp list
| Sum of aexp list
let diff : aexp * str
K是一個大型稀疏矩陣,y是一個向量。在一個特定的時間步長dt從t1到t1+dt: 方法一: 的expm導致: K = ...
y = ...
y = expm(-1i*dt*K)*y; %new y
方法2: 的ode45給出: K = ...
y = ...
y0 = y;
[T, Y] = ode45(@(t,y)dy(y,K),[t1 t1+dt],y0);
y = Y(e