Question
Hurricane Max is studying the movement of suspended particles inside a hurricane by using a simulator to predict their movements. The simulation does not track
Hurricane
Max is studying the movement of suspended particles inside a hurricane by using a simulator to predict their movements. The simulation does not track the height of the particles though, just the coordinates of the particle on the ground. The entire simulation takes place in 2-dimensions.
There are particles, and each one is given a starting position: in the simulator. The simulator has a simple model for movement of each particle: it is assumed that all the particles will move in a spiral like manner, although each will have its own parameters. Specifically, for each particle, Max associates an update vector which will always be used to update the position of that particle throughout the entire simulation. (Each particle has its own update vector.)
The rule to obtain the new position of a particle, , from its current position using update vector is given by the matrix computation:
In order to represent a diverse set of possible spirals, and are not necessarily integers, but in order to preserve precision, they will each be presented as rational numbers. To represent the update vector , 4 integers: will be supplied, and should be interpreted that
In a single "step" of the simulation, all the particles are updated by their update vector to compute their new positions. Those new positions are then used as the "current" positions for the next step, which again occurs with each particle's respective update vector. After performing steps, Max wants to know how many particles lie within the rectangle with its lower left corner at and its upper right corner at . Particles that lie on the boundary of the rectangle should be included in the count.
Help Max by writing a program to efficiently perform the steps of his simulation.
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