Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class called Particle to represent different kinds of particles in an N - body simulation. This class should have the following data: x

Create a class called Particle to represent different kinds of particles in an N-
body simulation. This class should have the following data:
x,y,z,vx,vy,vz-3D position and velocity values
ax, ay, az -3D acceleration values
*m- mass
It should have the following methods:
init_: initialize a Particle with m,x,y,z,vx,vy,vz passed in
move: - move the particle over a timestep dt using
x=x+vx***dt+0.5**ax**d*****2 etc.
compute_accels: compute total gravitational acceleration on the particle
due to a list of particles
Create a subclass, StarParticle. StarParticle should have in addition to the
base class:
t - age
age_stars: a method that increments the particle's age by dt
Don't forget to upload your work to Canvas, as usual!
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions