Question: Consider a system of particles in motion ( for example, a pressurized container of gas, where the gas molecules could be thought of as particles

Consider a system of particles in motion (for example, a pressurized container of gas, where the gas molecules
could be thought of as particles). Suppose the system has N particles, each with mass mi and velocity
vi=vx,ii+vy,ij+vz,ik for i=1,2,dots,N at some particular moment in time. The total momentum of this
system can be computed as
p=i=1Nmivi
and the total kinetic energy of the system could be computed as
E=12i=1Nmi|vi|2
where |vi|=vx,i2+vy,i2+vz,i22 denotes the magnitude (vector norm) of the velocity of particle i.
Write a function calc_mom_energy (m,v) that computes and returns the total momentum p and kinetic energy E
of the system. The input m is a 1D numpy array of size N that contains a list of particle masses, and the input v
is a N32D numpy array, where each row contains the velocity components (vx,i,vy,i,vz,i) of particle i.
Additionally, your code should perform basic error checking on the validity of the inputs by returning p=
np*zeros(3) for momentum and E= for the kinetic energy if either of the following is true:
The length of m and the number of rows in v are not equal
v does not have 3 columns
In your code below, the following function will be graded by checking several sets of input arguments:
 Consider a system of particles in motion (for example, a pressurized

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!