| | |
calculate car speed (mph) using speed of light
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2007
Posts: 7
Reputation:
Solved Threads: 0
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.
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.
>.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.
>.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.
![]() |
Similar Threads
- Needle which show's car speed can we use in vb (Visual Basic 4 / 5 / 6)
- clock speed (Motherboards, CPUs and RAM)
- whats wrong with my cpu fsb and ram bus speed? (Motherboards, CPUs and RAM)
- "cannot resolve symbol"problem (Java)
- calculate the execution time of a program (C)
- My high-speed is as slow as dial-up! (Networking Hardware Configuration)
- lite on 52327s speed problem, DMA issue? (Storage)
Other Threads in the C++ Forum
- Previous Thread: removing comments of c,c++, java styles
- Next Thread: Assitance required : The wdb front end has suffered a fatal internal error.
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph gui homeworkhelp iamthwee ifstream image input int java lib library list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






