Pythonã§ä¸çªæåã§æ®åãã¦ããã©ã¤ãã©ãªã¨è¨ã£ã¦ãéè¨ã§ã¯ãªããNumpyãã®è¦æ¸ãã§ããããªãå¤æ©è½ãªæ°å¤è¨ç®ã©ã¤ãã©ãªã§ãå
é¨ã¯Cè¨èªã§è¨è¿°ããã¦ããããè¶
é«éã«åä½ãã¾ãã ãã¯ãã« ãã¯ãã«ã®é·ãï¼æ£è¦å import numpy a = numpy.array([[2,2]]) #ãã¯ãã«ã®é·ã length = numpy.linalg.norm(a) #length=>2.8284271247461903 #ãã¯ãã«ã®æ£è¦å a / numpy.linalg.norm(a) #=>array([[ 0.70710678, 0.70710678]]) å
ç©ï¼å¤ç© import numpy v1 = numpy.array((1,0,0)) v2 = numpy.array((0,1,0)) #å
ç© numpy.dot(v1,v2) #=> 0 #å¤ç© numpy.cros
{{#tags}}- {{label}}
{{/tags}}