我是 Python 编程的新手。来自 MATLAB 背景。我正在寻找类似于 Python 中 MATLAB 的 symsum 函数的东西。
我有我的阵列,
a = np.linspace([0,3.14])
我想总结
sin(2*i*a) where i ranges from 1 to 20
然后在 a 和 y 之间绘制结果
我尝试了以下
y = nsum(lambda i: np.sin(2*i*a), [0,20])
我被困在这一点上。
编辑。MATLAB 等价物是
a = linspace(0,pi)
syms i
y=double(symsum(sin(2*i*a),i,0,20)