My Science calculators

Realistic Mods

Man on the Moon
Registered
#1
Hello friends!, Realistic Mods here,
I am an amateur python programmer. I recently made a calculator for converting distances to SFS scale, using python. Inspired from how apps can make duties easier, I set on to make some more. I had recently made a drag calculator, and yesterday a doppler shift distance calculator. Here, I will post some of the programs I will make. After completing a few, I will post it as a complete individual program.
Till then, here is my doppler shift velocity calculato-(You can paste them in an online python emulator, if you don't have python installed)

Doppler shift distance calculator ( Finds out whether a light source is approaching or receding depending on the doppler shift )
Python:
print('Hello User, Welcome!')
ow=float(input('Please enter the orignal wavelength- '))
dw=float(input('Please enter the detected wavelength '))
if dw>ow:
    a=1-dw/ow
    b=299792458*a
    print(' The source is receding at a velocity of', b,'m/s')
elif dw<ow:
    a=1+dw/ow
    b=299792458*a
    print('The source is approaching at a velocity of', b,'m/s')
print('Thank You')
Link for using- https://www.online-python.com/sbgkfz32DS
 

Altaïr

Space Stig, Master of gravity
Staff member
Head Moderator
Team Kolibri
Modder
TEAM HAWK
Atlas
Deja Vu
Under Pressure
Forum Legend
#2
I think you have to change the calculation of a to "dw/ow - 1" in the "if" case, because the result would be negative otherwise.

For the "elif" case I think it's "a = 1 - dw/ow" instead. I just verified quickly so I'm not fully sure, but what's sure is that if dw = ow (detected wave length is same as the original) you have to find a = 0, so that the speed is 0.

It doesn't take into account the relativistic dilatation effect too :p
 

Space pilot

ET phone home
Floater
Man on the Moon
Registered
#3
I think you have to change the calculation of a to "dw/ow - 1" in the "if" case, because the result would be negative otherwise.

For the "elif" case I think it's "a = 1 - dw/ow" instead. I just verified quickly so I'm not fully sure, but what's sure is that if dw = ow (detected wave length is same as the original) you have to find a = 0, so that the speed is 0.

It doesn't take into account the relativistic dilatation effect too :p
Oh it's been two years and I didn't know
We got programmer mod
Weeeeeeeee
 

Realistic Mods

Man on the Moon
Registered
#4
I think you have to change the calculation of a to "dw/ow - 1" in the "if" case, because the result would be negative otherwise.

For the "elif" case I think it's "a = 1 - dw/ow" instead. I just verified quickly so I'm not fully sure, but what's sure is that if dw = ow (detected wave length is same as the original) you have to find a = 0, so that the speed is 0.

It doesn't take into account the relativistic dilatation effect too :p
Thanks Altair!
I had tried to verify it, but I will check again. (Actually, even I don't know about relativistic dilation too:p)
Thanks for informing!
 

Realistic Mods

Man on the Moon
Registered
#5
Here's my Doppler Shift and Time Dilation calculators, Ready!

Doppler Shift Calculator
Python:
print('Hello User, Welcome!')
ow=float(input('Please enter the orignal wavelength- '))
dw=float(input('Please enter the detected wavelength '))
if dw>ow:
    a=1-dw/ow
    b=a*299792458
    print(' The source is receding at a velocity of', b,'m/s')
elif dw<ow:
    a=1+dw/ow
    b=a*299792458
    print('The source is approaching at a velocity of', b,'m/s')
else:
    print('The source is neither approaching, nor receding, please enter the exact values')
print('Thank You')
Link- https://www.online-python.com/UCq3iN6v0L
Here, a minus value means the source is receding, a plus value means the source is approaching

Time Dilation Calculator
Python:
print('Hello User, Welcome')
ti=float(input('Please enter the time interval-'))
v=float(input('Please enter the speed of subject in times the speed of light-'))
import math
y=1/math.sqrt(1-(v)**2)
rt=y*ti
print('The time at a rest frame will have passed',rt)
Link- https://www.online-python.com/KkNvsaCLuq

Enjoy!