compute_field.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:scipy-lecture-notes-zh-CN 作者: jayleicn 项目源码 文件源码
def base_vectors(n):
    """ Returns 3 orthognal base vectors, the first one colinear to n.
    """
    # normalize n
    n = n / np.sqrt(np.square(n).sum(axis=-1))

    # choose two vectors perpendicular to n
    # choice is arbitrary since the coil is symetric about n
    if abs(n[0]) == 1 :
        l = np.r_[n[2], 0, -n[0]]
    else:
        l = np.r_[0, n[2], -n[1]]

    l = l / np.sqrt(np.square(l).sum(axis=-1))
    m = np.cross(n, l)
    return n, l, m
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号