Answered step by step
Verified Expert Solution
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:
position and velocity values
ax ay az D acceleration values
mass
It should have the following methods:
init: initialize a Particle with passed in
move: move the particle over a timestep dt using
etc.
computeaccels: 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
agestars: a method that increments the particle's age by
Don't forget to upload your work to Canvas, as usual!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started