What's the difference between "numpy" and "math" modules in python ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's the difference between "numpy" and "math" modules in python ??

i hope that the majority of sololearn users who pass the python's certeficate to be masters can answer about that question because it has an easy answer 😉

18th Apr 2017, 6:53 AM
Mouwaffek Haggui
Mouwaffek Haggui - avatar
1 Answer
+ 4
math is a standard library that provides a number of functions (trigonometry, logarithms) and constants. numpy is a different league. It is a mathematical library written in C. The major object of numpy is a homogenenous multidimensional array, the ndarray. This array allows to perform mathematical operations on the whole array (or columns, rows) without looping over the elements. Moreover, ndarrays can be multiplied (other fundamental operations work as well) even if the dimensions of the arrays aren't identical. More often than not, the smaller array is automatically enlarged (by duplicating rows or columns) to make these calculations possible. In short, numpy is very powerful and blazingly fast. In addition, it is the fundament of the data analysis library pandas.
18th Apr 2017, 7:06 AM
Klaus-Dieter Warzecha
Klaus-Dieter Warzecha - avatar