我试着用del算符计算一个向量的旋度,所以我用sympy的旋度,让向量和参考系交叉,但是我得到了一个错误:我到底做错了什么?你知道吗
import sympy
import numpy as np
import math
from sympy import Symbol, diff, Array, sin, cos, curl
from sympy import init_printing
from sympy.physics.vector import curl, ReferenceFrame
init_printing()
# Variables being used - B0 is the initial mag field, alpha is a constant. x/y/z are for the direction
alpha = Symbol('\u03B1')
B0 = Symbol('B0')
x = Symbol('x')
y = Symbol('y')
z = Symbol('z')
print ('Symbols: ', alpha, B0, x, y, z)
# This has the reference frame and the vector
R = ReferenceFrame('R')
V = B0*sin(alpha*x)*R.y + B0*cos(alpha*x)*R.z
print(V)
C = curl(V,R)
print(C)
我在等一个/nabla运算符穿过向量。你知道吗
使用
R[0]
而不是x
。我从curl
示例中推断出这一点(并尝试复制一些Wiki示例)正在运行
isympy
(无法从
sympy
导入curl
)有一种方法可以分解出
alpha
,或者显示C
是alpha*V
。我正在学习sympy
教程。你知道吗相关问题 更多 >
编程相关推荐