Download Computational Mechanics featuring Matlab
Transcript
7.8. END OF CHAPTER PROBLEMS 145 (17a) Write a script that generates N random masses between minM and maxM kg and N random velocity vectors (x, y, z components) with component magnitudes between minV and maxV. Print out the individual kinetic energies and the total kinetic energy of the eight particles. Every time you run the script, it should generate new random masses and velocities. Test the script with N=8, minM=1, maxM=10 kg, minV=-100 m/s, maxV=100 m/s. (17b) Extend the script from part a to calculate the velocity, speed and kinetic energy of the center of mass of the 8-body system. (17c) Extend the script further to calculate the kinetic energy of the masses relative to the center of mass. The part b and c results should sum to the energy from part a. Your script should demonstrate that this is so. Run the script 10 times and thus demonstrate numerically that total kinetic energy breaks into the kinetic energy of the center of mass + the kinetic energy relative to the center of mass. (18) Write a Matlab function defined as follows: 1 f u n c t i o n [ R]= s c h a r z c h i l d R a d i u s (M) 2 %M [ k g ] : M a s s o f l a r g e b o d y 3 %R [ m ] : S c h w a r z c h i l d Radius o f body Test your function with a script that prints out the Schwarzchild radius of the Earth, the Sun, and your own body. The Schwarzchild radius is defined in problem 6.