Created
November 10, 2020 18:00
-
-
Save toyballz/05225866ccf3fc8c0131a8c668fa8539 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
#create the vectors | |
x = np.array([3,5]) | |
s = np.array([3,2]) | |
#use the formula | |
projection_x_on_s = (np.dot(x,s)/np.dot(x,x))*s | |
print(projection_x_on_s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment