943,545 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 4854
  • C++ RSS
Oct 22nd, 2007
0

calculate car speed (mph) using speed of light

Expand Post »
I need to write two functions to calculate the speed and the $fine for over speeding. The formula I need to use is: V = c * (W0 – W1) / W0

I wrote the function to calculate the speed, but the results are incorrect, using the formulas below.

V = speed
C = speed of light (669,600,000 miles per hour)
W0 = wavelength of red light (.533 microns)
W1 = wavelength of green light (.674 microns)

V = 669600000 * (.674 - .533 ) / .674


The formula is correct, except that the values of microns are incorrect. The assigned value (.533 & .674) needs to be converted into miles, but even when I did the conversion, the results are still not correct.

.533 microns converted to miles per hour = 3.311908
.674 microns converted to miles per hour = 4.188042

I would appreciate if someone can tell me what type of conversion I need for the microns, I would greatly appreciate it.

Thanks.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pyramid is offline Offline
7 posts
since Oct 2007
Oct 22nd, 2007
0

Re: calculate car speed (mph) using speed of light

if 1 micron is 1/1000000000 of a km, that means 1 micron pero hour is 1/60000000000 km/hour... in miles, that is 1.6/60000000000 mi/hour, so your conversion should be .533*1.6/60000000000 for red light, and .674 * 1.6/60000000000 for green light...
Featured Poster
Reputation Points: 424
Solved Threads: 57
Posting Virtuoso
Nichito is offline Offline
1,594 posts
since Mar 2007
Oct 22nd, 2007
-1

Re: calculate car speed (mph) using speed of light

>.533 microns converted to miles per hour = 3.311908
>.674 microns converted to miles per hour = 4.188042
Well, first, you need to remove the "per hour" part of that. The conversion is strictly distance, not distance over time. Second, you're neglecting to include the exponent in the miles value. The conversion is actually:

.533 microns converted to miles per hour = 3.311908e-10
.674 microns converted to miles per hour = 4.188042e-10

That's quite a significant difference in value.
Reputation Points: 44
Solved Threads: 8
Junior Poster in Training
Ptolemy is offline Offline
62 posts
since Oct 2007
Oct 23rd, 2007
0

Re: calculate car speed (mph) using speed of light

Thanks you guys.
I finally got my codes to work, and have submitted my lab.

You are correct, including the exponent in the miles value made a SIGNIFICANT difference.


Thanks again.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pyramid is offline Offline
7 posts
since Oct 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: removing comments of c,c++, java styles
Next Thread in C++ Forum Timeline: Assitance required : The wdb front end has suffered a fatal internal error.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC