我有一个冯诺依曼方程,它看起来像: dr/dt = - i [H, r],其中 r 和 H 是复数的方阵,我需要使用 python 脚本找到 r(t) 。
是否有任何标准仪器可以整合这些方程?
当我用向量作为初始值求解另一个方程时,例如 Schrodinger equation: dy/dt = - i H y,我使用了 scipy.integrate.ode 函数('zvode'),但尝试对冯诺依曼使用相同的函数方程给了我以下错误:
**scipy/integrate/_ode.py:869: UserWarning: zvode: Illegal input detected. (See printed message.)
ZVODE-- ZWORK length needed, LENZW (=I1), exceeds LZW (=I2)
self.messages.get(istate, 'Unexpected istate=%s' % istate))
In above message, I1 = 72 I2 = 24**
Run Code Online (Sandbox Code Playgroud)
这是代码:
def integrate(r, t0, t1, dt):
e = linspace(t0, t1, (t1 - t0) / dt + 10)
g = …Run Code Online (Sandbox Code Playgroud) 我有一个问题:没有匹配函数来调用'begin(int*&)'我发现的唯一提示是编译器在编译时可能不知道数组的大小,但我相信这不是我的案件.这是我得到的:
template <typename T>
void heapSort(T array[]) {
size_t length = std::end(array) - std::begin(array);
if (length == 0) {
return;
}
Heap<T> heap(array);
for (size_t i = length - 1; i >= 0; --i) {
array[i] = heap.pop();
}
}
int main() {
int array[] = {9, 8, 10, 99, 100, 0};
for (auto i = 0; i < 6; ++i) {
std::cout << array[i] << " ";
}
std::cout << std::endl;
heapSort(array);
for (auto i = 0; i < …Run Code Online (Sandbox Code Playgroud)