• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版6612252ca3b5cc2900a43872987f35bd8ffc9d21 (tree)
时间2024-06-26 04:53:05
作者Lorenzo Isella <lorenzo.isella@gmai...>
CommiterLorenzo Isella

Log Message

I simple python script showcasing new.axis to quickly define a matrix in Python.

更改概述

差异

diff -r 0bd265396234 -r 6612252ca3b5 Python-codes/matrix_easy.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Python-codes/matrix_easy.py Tue Jun 25 21:53:05 2024 +0200
@@ -0,0 +1,21 @@
1+import numpy as np
2+
3+#Now it is time to evaluate the matrix N_mat[i,j]=n[i]n[j]
4+
5+n= np.arange(4)
6+
7+n
8+
9+m=np.arange(6)
10+
11+m
12+
13+## Now I will define the matrix N_mat[i,j]=m[i]*n[j] with 6 rows
14+## and 4 columns
15+
16+N_mat=m[:,np.newaxis]*n[np.newaxis,:]
17+
18+N_mat
19+
20+## which is very close to the mathematical definition. Can I achieve something
21+## similar in R?