Add files via upload

This commit is contained in:
Visualize-ML
2022-09-02 06:06:41 -04:00
committed by GitHub
parent f68f6e700b
commit 9822d0a7e5
13 changed files with 230 additions and 102 deletions

View File

@@ -0,0 +1,24 @@
###############
# Authored by Weisheng Jiang
# Book 4 | From Basic Arithmetic to Machine Learning
# Published and copyrighted by Tsinghua University Press
# Beijing, China, 2022
###############
# Bk4_Ch2_11.py
import numpy as np
a = np.array([-2, 1, 1])
b = np.array([1, -2, -1])
# a = [-2, 1, 1]
# b = [1, -2, -1]
# calculate cross product of row vectors
a_cross_b = np.cross(a, b)
a_col = np.array([[-2], [1], [1]])
b_col = np.array([[1], [-2], [-1]])
# calculate cross product of column vectors
a_cross_b_col = np.cross(a_col,b_col,axis=0)