<< Chapter < Page Chapter >> Page >

Screen output

The text shown in Figure 3 should appear in your browser window when the html file is opened in your browser.

Figure 3 . Screen output for Listing #2.
Start Script Time for leg A = 0.30 secondsTime for leg B = 0.33 seconds Displacement magnitude = 25.00 feetDisplacement angle = 98.13 degreesTotal time = 0.63 seconds Average velocity magnitude = 39.47 feet/secondAverage velocity angle = 98.13 degrees End Script

Analysis of the code

In this exercise, the puck makes a journey across the ice consisting of two sequential legs in different directions with different magnitudes ofvelocity. Although each leg involves motion along a line, the total trip is not along a line.

The objective of the script is to

  • Compute and display the time required to traverse each leg of the trip based on the given information.
  • Compute and display the magnitude and the angle of the displacement from start to finish.
  • Compute and display the time required to complete the entire trip, which is the sum of the times from both legs.
  • Compute and display the magnitude of the average velocity as the magnitude of the displacement divided by the total time.
  • Recognize that the angle of the average velocity is the same as the angle of the displacement.

The getAngle function

The code in Listing 2 begins with the getAngle function that we developed and used an earlier module. The purpose of the function is to receive the adjacentand opposite side values for a right triangle as parameters and to return the angle in degrees in the correct quadrant.

I explained this function in an earlier module and won't repeat that explanation in this module.

Compute the time for each leg

Following the definition of the getAngle function, Listing 2 computes the time required to traverse each leg of the trip. For variable naming purposes, the two legs are identified as A and B.

Variable names that end with "mag" contain vector magnitudes. Variable names that end with "ang" contain vector angles. Variable names that endwith "vel" contain the magnitudes of straight-line, uniform velocities.

The time to complete each leg of the trip is computed by dividing the magnitude of the displacement vector for that leg by the magnitude of thestraight-line velocity for that leg. The resulting times have units of seconds, and are saved in the variables named timeA and timeB .

The overall displacement

The magnitude and angle of the overall displacement for the two-leg trip (identified by the variables named vecResultMag and vecResultAng respectively) are computed using procedures that were explained in an earlier module. Therefore, I won't repeat that explanation inthis module.

The magnitude of the overall displacement is stored in the variable named vecResultMag , and the angle for the overall displacement is stored in the variable named vecResultAng .

The total time

The total time for the trip, identified by the variable named totalTime , is computed as the sum of the times for the individual legs.

Magnitude of the average velocity vector

Questions & Answers

Commplementary angles
Idrissa Reply
hello
Sherica
im all ears I need to learn
Sherica
right! what he said ⤴⤴⤴
Tamia
what is a good calculator for all algebra; would a Casio fx 260 work with all algebra equations? please name the cheapest, thanks.
Kevin Reply
a perfect square v²+2v+_
Dearan Reply
kkk nice
Abdirahman Reply
algebra 2 Inequalities:If equation 2 = 0 it is an open set?
Kim Reply
or infinite solutions?
Kim
y=10×
Embra Reply
if |A| not equal to 0 and order of A is n prove that adj (adj A = |A|
Nancy Reply
rolling four fair dice and getting an even number an all four dice
ramon Reply
Kristine 2*2*2=8
Bridget Reply
Differences Between Laspeyres and Paasche Indices
Emedobi Reply
No. 7x -4y is simplified from 4x + (3y + 3x) -7y
Mary Reply
is it 3×y ?
Joan Reply
J, combine like terms 7x-4y
Bridget Reply
im not good at math so would this help me
Rachael Reply
how did I we'll learn this
Noor Reply
what is nanomaterials​ and their applications of sensors.
Ramkumar Reply
what is nano technology
Sravani Reply
what is system testing?
AMJAD
preparation of nanomaterial
Victor Reply
Yes, Nanotechnology has a very fast field of applications and their is always something new to do with it...
Himanshu Reply
good afternoon madam
AMJAD
what is system testing
AMJAD
what is the application of nanotechnology?
Stotaw
In this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google
Azam
anybody can imagine what will be happen after 100 years from now in nano tech world
Prasenjit
after 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments
Azam
name doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world
Prasenjit
how hard could it be to apply nanotechnology against viral infections such HIV or Ebola?
Damian
silver nanoparticles could handle the job?
Damian
not now but maybe in future only AgNP maybe any other nanomaterials
Azam
can nanotechnology change the direction of the face of the world
Prasenjit Reply
At high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.
Ali Reply
the Beer law works very well for dilute solutions but fails for very high concentrations. why?
bamidele Reply
Got questions? Join the online conversation and get instant answers!
QuizOver.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Game 2302 - mathematical applications for game development. OpenStax CNX. Jan 09, 2016 Download for free at https://legacy.cnx.org/content/col11450/1.33
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Game 2302 - mathematical applications for game development' conversation and receive update notifications?

Ask