The Physics of Computer Science

Download Report

Transcript The Physics of Computer Science

The Physics of Computer Science
By Matthew Pinney
A Brief look at how physics is related
to Computer Science and a sample
application of problem solution.
What is Computer Science
• To fully understand the connection between
computer science and physics, let’s look at the
definition of computer science.
• Wikipedia defines: Computer science (or
computing science) is the study and the
science of the theoretical foundations of
information and computation and their
implementation and application in computer
systems.
What is Computer Science
• Edsger Dijkstra, a renowned computer
scientist, once stated, "Computer science is no
more about computers than astronomy is
about telescopes."
• Computer science spans a range of topics
from theoretical studies of algorithms and the
limits of computation to the practical issues of
implementing computing systems in hardware
and software
Physically Relevant
• John P. Hayes, founding director of Michigan's
Advanced Computer Architecture Laboratory and
author of several books
• “There's a different form of computation that can be
based on quantum physics. That turns out to be a very
rich area, at least from the theoretical viewpoint. It's
particularly exciting because -- although it's at a
primitive stage of development -- it has a killer
application. Namely, there is an algorithm for factoring
numbers that is exponentially faster than any known
classical algorithm for that problem. Quantum
computing raises the possibility of very fast factoring,
which has an immediate application in code breaking.”
Physically Relevant
• Physical based modeling animation is one of
the methods of 3D graphics.
• Uses principals of physics and non-linear
motion equations to determine the animation
path
• Physics fundamentals are also the basis for
lighting a scene.
Physically Relevant
• Along with graphics, physics is related to
Computer Science with the need for
simulation.
• Simulations can be used to test many different
types of designs.
• Simulators also prepare people for future
tasks.
The Solution to the Problem
• We are given a track that is 100 meters long.
For ease of working the problem, I would let
the center be 0 with the left end being -50 and
the right end being 50. I will also assume that
moving left will be a negative velocity, right
being positive.
• We will also be given the cart’s mass (m) ,
velocity(v), location on the track (x = position50), and coefficient of friction (mu)
The Solution to the Problem
• We are also given the eight rules to apply:
– 1. If in the middle and standing still then no force
– 2. If left then push
– 3. If right then pull
– 4. If middle then no force
– 5. If moving left then push
– 6. If standing still then none
– 7. If moving right then push
– 8. If right and moving right then pull
The Solution to the Problem
• My algorithm for solving the problem would
be to use a while loop with the condition that
it would repeat until the cart is at center
position(or the cart moves off of the track).
For ease of equations, each pass of the loop
would simulate one second of time.
• The first part of the loop would be to examine
what rule should be applied based off the
current velocity and position.
The Solution to the Problem
• The next part of the loop would be to
determine the direction and strength of the
force to apply. This would be done by using
Newton’s second law: F = m * a.
• Reworking of the equation and allotting for all
forces gives us the equation a =
(F[friction]+F[applied])/m.
• Also needed would be the equation v = v + a*t
The Solution to the Problem
• Assuming the time to be one second, the
result would be v = v + a.
• Using branching logic, I would first check the
location of the cart. If it is not near the center,
then a full Newton of force could be used.
• Next, if it is near the center, I would test to see
if the full Newton of force would be more than
enough to stop the cart
The Solution to the Problem
• If it is, then I would determine the portion of
the Newton that would be necessary to stop
the cart on the center.
• The last part of the loop would be to update
the variables being used with the new applied
force.
• Using the a = (F[friction]+F[applied])/m
equation and the v = v + a equation, I would
be able to find the new velocity
The Solution to the Problem
• From there, I would be able to update the
location variable by using the equation x = v*t
+ ½ * a * t. Since one loop would simulate one
second, this could be shortened to deltax = v +
½ * a. Thus x = x + deltax.
• This would give us a new position and velocity
for the next loop to observe.
• If the cart is at the center ( or |x| > 50), I
would now end the loop.
The Sources of the Solution
• http://www.acm.org/ubiquity/interviews/j_ha
yes_1.html?searchterm=physics+relationship+
computer
• http://siggraph.org/~rhyne/com97/com97tut.html?searchterm=physics+of+motion
• http://en.wikipedia.org/wiki/Computer_scien
ce
• http://hyperphysics.phyastr.gsu.edu/hbase/mot.html