jeudi 1 décembre 2016

Using python to add random Matrices with Numpy

So I need to add random matrices in python. I have this code to generate a random matrix:

import numpy as np 
import random

def generate_matrix(m, n):
  A = np.random.randint(100, size=(m, n))
  B = np.random.randint(100, size=(m, n))
  return A

However, I need to create a function so that I can add two random matrices. all I have is the starting function and I am just stuck.

def add(A, B):




Aucun commentaire:

Enregistrer un commentaire