【发布时间】:2019-09-11 04:10:07
【问题描述】:
我正在尝试使用其 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 运算符穿过向量。
【问题讨论】:
-
显示完整的回溯(问题中格式正确的文本)。
-
什么是 B0、alpha、R?符号?展示你如何初始化它们。给我们一些适用于 copy-n-paste 的东西。
-
我用常量和它们的用途编辑了我的问题
-
根据文档和代码,
curl扩展了计算,dot等等。它为我运行并打印0。 -
我确实应该将 alpha* 向量作为 curl 恢复。但我不明白我是如何得到错误的
标签: python curl vector typeerror sympy