Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
だから私は2つの行列を使って基本的な数学を実行したい.
入力として、2 つの 3x3 行列があります。matrixA のすべての整数を matrixB のすべての整数で除算し、出力をその積の 1 つの 3x3 行列にしたいと思います。
私のためにそれを行うことができるR関数は何ですか.
前もって感謝します!
要素ごとに分割したいようです。この場合、単純に/演算子を使用できます。
/
### Create two matrices matA <- matrix(1:9, nrow = 3) matB <- matA ### Divide element by element matB / matA ### As Frank pointed out, division by 0 goes to Inf matA[1, 1] <- 0 matB / matA