Squares

General FreeBASIC programming questions.
Locked
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Squares

Post by caseih »

albert wrote:We know from practice that if you travel to slow the orbit decays. Could it also decay if you go too fast?
No that's absolutely incorrect. Orbits decay because of other forces robbing an object of energy. Gravity from other bodies in the solar system, the atmosphere, hitting other objects, etc. Absent external forces, an object in orbit remains in orbit indefinitely. It slows down and speeds up in a cycle based on the conversion of potential to kinetic energy and vice versa.

If you slow your speed down, you'll actually increase your orbit diameter.

Years ago my cousins implemented a 2-D simulation of the Apollo flights to the moon. Everything was done with correct orbital mechanics. Pretty neat. Showed exactly how they did it (albeit in 2 dimensions only).
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Squares

Post by BasicCoder2 »

dodicat wrote:Basiccoder2
Your desktop only 600 pixels high?
Have you a laptop perhaps?
Yes I have a laptop, 1366x768
The text on the bottom of your display is covered by the task bar.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Squares

Post by BasicCoder2 »

caseih wrote:Years ago my cousins implemented a 2-D simulation of the Apollo flights to the moon. Everything was done with correct orbital mechanics. Pretty neat. Showed exactly how they did it (albeit in 2 dimensions only).
As I suggested earlier that might be a neat game for one of you math experts to write. A bit like the Lunar Lander games except you have to fly from one planet such as Earth and land or orbit another planet such as the moon.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

So , how does Pluto have a 12 times difference in (distance * speed) compared to Mercury's (distance * speed) ?
I think the distances are wrong or the speeds are all wrong.

The Internet vary's widely on Pluto's distance. 2.79 billion to 4.99 billion in miles , with an avg as 3.6 billion miles i used in the below code..
If you take out the ellipse , how far would it be?

Code: Select all


screen 19

'       planet distance * speed  /   (mercurys distance * speed)
print (3600000000 * 10623) / (29000000 * 107082)   ; " pluto / mercury energy difference "
print (2800000000 * 12146) / (29000000 * 107082)   ; " neptune / mercury energy difference"  
print (1790000000 * 15233) / (29000000 * 107082)   ; " uranus / mercury energy difference"  
print (889000000 * 21675)   / (29000000 * 107082)   ; " saturn / mercury energy difference"
print (484000000 * 29236)   / (29000000 * 107082)   ; " jupiter / mercury energy difference"
print (142000000 * 53858)   / (29000000 * 107082)   ; " mars / mercury energy difference"
print (91000000 * 66615)    / (29000000 * 107082)   ; " earth / mercury energy difference"
print (66000000 * 78337)    / (29000000 * 107082)   ; " venus / mercury energy difference"

sleep 
end

In a lossless system ; the distance * speed , should be the same for all orbitals.
The further out you go the slower the orbits. ( Our solar system follows that to a degree , but its not the same for all orbitals, like it should be.)
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Squares

Post by caseih »

albert wrote:So , how does Pluto have a 12 times difference in (distance * speed) compared to Mercury's (distance * speed) ?
I think the distances are wrong or the speeds are all wrong.

...

In a lossless system ; the distance * speed , should be the same for all orbitals.
The further out you go the slower the orbits. ( Our solar system follows that to a degree , but its not the same for all orbitals, like it should be.)
You can think whatever you want of course. But the reality is you simply have the relationships wrong in your formulas. There are formulas for calculating the orbital parameters, and the link shared not so long ago contained them. There are numerous factors that go into the equation, such as the masses involved, the total energy, the eccentricity of the orbit, etc.

Yes the farther out from the sun you go, the slower the planetary orbits are. Our solar system follows that not just to a degree, but completely. Even comets who travel from beyond pluto and pass closer to the sun than we are before returning follow the same equations and exhibit the same behavior.

I guess I don't understand why you insist on bumbling in the dark when you could simply apply the formulas that have been worked out by those that have observed the heavens and know a bit about what's going on there. Reminds me of the crazy methods of trying to explain the motions of the heavenly bodies in ancient times with epicycles, as they didn't yet understand ellipses. It's like you claim to be interested in knowledge and science, but actually not at all interested. You can't poke holes in common physics theories if you don't understand the theories.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

I fumbled around a little and used the earths distance * speed to calculate the other planets distances.
In my theory : you should be able to calculate the distance or speed of a orbital by comparing it to the speed or distance of any of the other orbitals.
In my theory : all orbitals should have the same energy. all orbitals are in freefall , so mass is irrelevant.

Code: Select all


screen 19

' earth distance * speed  , planets speed
print (91000000 * 66615) / 107082  ; " mercury distance from sun"
print (91000000 * 66615) / 78337    ; " venus distance from the sun"
print (91000000 * 66615) / 66615    ; " earth distance from the sun"
print (91000000 * 66615) / 53858    ; " mars distance from the sun"
print (91000000 * 66615) / 29236    ; " jupiter distance from the sun"
print (91000000 * 66615) / 21675    ; " saturn distance from the sun"
print (91000000 * 66615) / 15233    ; " uranus distance from the sun"
print (91000000 * 66615) / 12146    ; " neptune distance from the sun"
print (91000000 * 66615) / 10623    ; " pluto distance from the sun"

sleep 
end

dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Post by dodicat »

Deep space very spiral galaxy.

Code: Select all


Type vector3d
    As Single x,y,z
End Type
#define V3 vector3D
Type angle 
    As Single a(1 To 6)
    declare sub set(as V3)
End Type

sub angle.set(a as V3)
this=Type({Sin(a.x),Sin(a.y),Sin(a.z),Cos(a.x),Cos(a.y),Cos(a.z)})
end sub
#define vct Type<vector3d>


Function Rotate3D(c As V3,p As V3,a As angle,scale As V3=type(1,1,1)) As V3
    Dim As Single dx=p.x-c.x,dy=p.y-c.y,dz=p.z-c.z
    Return type((scale.x)*((a.a(5)*a.a(6))*dx+(-a.a(4)*a.a(3)+a.a(1)*a.a(2)*a.a(6))*dy+(a.a(1)*a.a(3)+a.a(4)*a.a(2)*a.a(6))*dz)+c.x,_
    (scale.y)*((a.a(5)*a.a(3))*dx+(a.a(4)*a.a(6)+a.a(1)*a.a(2)*a.a(3))*dy+(-a.a(1)*a.a(6)+a.a(4)*a.a(2)*a.a(3))*dz)+c.y,_
    (scale.z)*((-a.a(2))*dx+(a.a(1)*a.a(5))*dy+(a.a(4)*a.a(5))*dz)+c.z)
End Function

Function apply_perspective(p As vector3d,eyepoint As vector3d) As vector3d
    Dim As Single   w=1+(p.z/eyepoint.z)
    If w=0 Then w=1e-20
    Return Type<vector3d>((p.x-eyepoint.x)/w+eyepoint.x,(p.y-eyepoint.y)/w+eyepoint.y,(p.z-eyepoint.z)/w+eyepoint.z)
End Function
'====================== End of rotator and perspective  ======================================

#macro incircle(cx,cy,r,mx,my,a)
iif(a<=1,a*(cx-mx)*a*(cx-mx) +1*(cy-my)*1*(cy-my)<= r*r*a*a,a*(cx-mx)*a*(cx-mx) +1*(cy-my)*1*(cy-my)<= (r)*(r))
#endmacro

#define map(a,b,x,c,d) ((d)-(c))*((x)-(a))/((b)-(a))+(c)
#define Intrange(f,l) Int(Rnd*((l+1)-(f))+(f))

#macro star(starx,stary,size,col,rot)
Scope
    Var count=0,rad=0.0,_px=0.0,_py=0.0,pi=4*atn(1),prime=rgb(255,254,253)
    for x as integer=1 to 2
    For z As Single=0+.28 +rot To 2*pi+.1+.28 +rot Step 2*pi/10
        count=count+1
        If count Mod 2=0 Then rad=size Else rad=.4*size
        _px=starx+rad*Cos(z)
        _py=stary+rad*Sin(z)
        If count=1 Then Pset (_px,_py)Else Line -(_px,_py),prime
    Next z
    Paint (starx,stary),prime,prime
    count=0:prime=col
    next x
End Scope
#endmacro

Function Regulate(Byval MyFps As long,Byref fps As long) As long
    Static As Double timervalue,lastsleeptime,t3,frames
    frames+=1
    If (Timer-t3)>=1 Then t3=Timer:fps=frames:frames=0
    Var sleeptime=lastsleeptime+((1/myfps)-Timer+timervalue)*1000
    If sleeptime<1 Then sleeptime=1
    lastsleeptime=sleeptime
    timervalue=Timer
    Return sleeptime
End Function

Dim As Integer number=10000
Dim As Integer xres,yres
Screen 20,32
Screeninfo xres,yres

Color , Rgb(0,0,20)

Redim As vector3d array(0)
Redim As Ulong colour(0)
For n As Integer=1 To number step 4
    Var xpos=xres\2+(200-n/100)*cos(n/100)+rnd*5-rnd*5
    Var ypos=yres\2+(200-n/100)*sin(n/100)+rnd*5-rnd*5
    var zz=map(1,number,n,-1,1)
    Var zpos=(10000)*cos(zz*1.5)
    If incircle(xres/2,yres/2,.4*yres,xpos,ypos,(1+(n/(.5*number)))) Then
        Redim Preserve array(1 To Ubound(array)+1)
        array(Ubound(array))=vct(xpos,ypos,zpos)
        Redim Preserve colour(1 To Ubound(colour)+1)
        colour(Ubound(colour))=Rgb(IntRange(150,255),IntRange(150,255),IntRange(150,255))
    End If
Next n

Dim As vector3d centre=vct(xres/2,yres/2,0)
Dim As vector3d eyepoint=vct(xres/2,yres/2,1000)
Dim As angle ang
dim as v3 da
Dim As long fps
Do
    if multikey(77) then eyepoint.x=eyepoint.x+5 'r
    if multikey(75) then eyepoint.x=eyepoint.x-5  'l
    if multikey(72) then eyepoint.y=eyepoint.y-5  'up
    if multikey(80) then eyepoint.y=eyepoint.y+5  'down
    if eyepoint.y<0 then eyepoint.y=0
    if eyepoint.y>yres then eyepoint.y=yres
    if eyepoint.x<0 then eyepoint.x=0
    if eyepoint.x>xres then eyepoint.x=xres
    da.z=da.z+.01
    ang.set(da)
    Screenlock
    Cls
    For n As Integer=1 To Ubound(array)
        array(n).z=array(n).z-4
        Var temp=rotate3d(centre,array(n),ang,vct(1,1,1))
        temp=apply_perspective(temp,eyepoint)
        Var radius=map(0,-1000,temp.z,1,2.5)
        star(temp.x,temp.y,radius,colour(n),20*da.z)
        If array(n).z<-1000 Then array(n).z=1500
    Next n
    Draw String(20,20),"Frames per second = " & fps 
    Screenunlock
    Sleep regulate(65,fps),1
Loop Until inkey=chr(27)
 
    
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

Hi everyone!!!

Nice doodle Dodicat!!

Just some more fumbling.. but it seem to hold weight...


For gravity dropping off 1 mph per mile distance.

( moons speed mph = 2288 ) × (moons distance miles = 238,900) = 546,603,200 mph earth core speed

546,603,200 ÷ orbit radius ((7,926÷2)+99) = 134,565.041851305 mph orbit speed

134,565.041851305 ÷ 3600 = 37.379178292 miles a second get into orbit speed.

25,211.25975 miles orbit circumference ÷ 37.379178292 = 674.473353937 seconds per orbit

674.473353937 / 60 = 11.241222566 minute orbit at 99 miles up.


I've read that the U.S. Govt. was able to maintain a 16 minute orbit..So a 16 minute orbit must be about 150 miles up , with my ether theory??

The orbit distance * orbit speed , should all equal each other.. I think?? ( not sure?? )
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Squares

Post by badidea »

albert wrote:I've read that the U.S. Govt. was able to maintain a 16 minute orbit..So a 16 minute orbit must be about 150 miles up , with my ether theory??
Where did you read that? A Donald Trump tweet? I think it was fake news. Fastest orbital period for Earth is just above the surface (ignoring air resistance and trees) and is 84.5 minutes. See: http://hyperphysics.phy-astr.gsu.edu/hb ... le.html#c1 Or calculate it yourself with:
period = (2 * PI * rEarth) / sqr(G * mEarth / rEarth)
albert wrote:The orbit distance * orbit speed , should all equal each other.. I think?? ( not sure?? )

Have you tried "The orbit distance * orbit speed ^ 2"? The result should be G * mass Sun
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

( moons speed mph = 2288 ) × (moons distance miles = 238,900) = 546,603,200 mph earth core speed
(core speed mph = 546,603,200) ÷ ( core circumference = 2,387 ) = 228,991.705069124 circumferences an hour.
228,991.705069124 ÷ 60 = 3,816 earths core spin in rpm's

( mercury's distance = 29000000) x ( mercury's speed = 107082 ) = 3.105378×10¹² mph sun core speed.
( sun core speed = 3.105378×10¹² ) ÷ ( suns core circumference = (200000×3.14159)) = 4,942,366 circumferences an hour
circumference an hour = 4,942,366 ÷ 60 = 82,372 suns core spin in rpm's


( earth speed = 67,000) ÷ ( earth core rpm = 3,816) = 17.5577 miles per rev
( suns speed = 450,000) ÷ ( sun core rpm = 82,372 ) = 5.463021415 miles per rev
( suns speed = 450,000) ÷ ( earths miles per rev = 17.5577 ) = 25,629 rpm if sun rotates at the same revs per mile as the earth.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

I got the solar system figured out, the "Ether" drops off in speed in steps.

Code: Select all


screen 19

type solar
    distance as ulongint
    speed    as ulongint
    name as string
end type

dim as solar planets(9)
planets(0).distance = 100000          : planets(0).speed = 17500000  : planets(0).name = "core"
planets(1).distance = 29000000     : planets(1).speed = 107082     : planets(1).name = "mercury"
planets(2).distance = 67240000     : planets(2).speed = 78337       : planets(2).name = "venus"
planets(3).distance = 93000000     : planets(3).speed = 67000       : planets(3).name = "earth"
planets(4).distance = 142000000   : planets(4).speed = 53858       : planets(4).name = "mars"
planets(5).distance = 484000000   : planets(5).speed = 29236       : planets(5).name = "jupiter"
planets(6).distance = 889000000   : planets(6).speed = 21675       : planets(6).name = "saturn"
planets(7).distance = 1790000000 : planets(7).speed = 15233       : planets(7).name = "uranus"
planets(8).distance = 2800000000 : planets(8).speed = 12146       : planets(8).name = "neptune"
planets(9).distance = 3600000000 : planets(9).speed = 10623       : planets(9).name = "pluto"

for a as longint = 1 to 9 
    print planets(a).distance , planets(a).speed , planets(a).name
next

print
print

for a as longint = 1 to 9 
    print planets(a).distance * planets(a).speed ; " " ;  planets(a).name ; " speed * distance."
next 

print
print

for a as longint = 1 to 9 step 1
    print (planets(a).distance * planets(a).speed) / (planets(a-1).distance * planets(a-1).speed)  , planets(a).name , planets(a-1).name
next

sleep 
end

albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

Heres an interesting site... It gives all the data for the solar system...

http://www.enchantedlearning.com/subjec ... my/planets
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

I figured out the ether speed drop off speeds...

How many mph it drops off between planets. Run code , see bottom numbers.

Code: Select all


screen 19

type solar
    distance as double
    speed    as double
    name as string
end type

'36000000 ; " mercury"
'67200000 ; " venus"
'93000000 ; " earth"
'14160000 ; " mars"
'48360000 ; " jupiter"
'88670000 ; " saturn"
'178400000 ; " uranus"
'279440000 ; " neptune"
'367450000 ; " pluto"

dim as solar planets(9)
planets(0).distance = 100000          : planets(0).speed = 0                : planets(0).name = "core"
planets(1).distance = 29000000     : planets(1).speed = 107082     : planets(1).name = "mercury"
planets(2).distance = 67200000     : planets(2).speed = 78337       : planets(2).name = "venus"
planets(3).distance = 92000000     : planets(3).speed = 67000       : planets(3).name = "earth"
planets(4).distance = 141600000   : planets(4).speed = 53858       : planets(4).name = "mars"
planets(5).distance = 483600000   : planets(5).speed = 29236       : planets(5).name = "jupiter"
planets(6).distance = 886700000   : planets(6).speed = 21675       : planets(6).name = "saturn"
planets(7).distance = 1784000000 : planets(7).speed = 15233       : planets(7).name = "uranus"
planets(8).distance = 2794400000 : planets(8).speed = 12146       : planets(8).name = "neptune"
planets(9).distance = 3674500000 : planets(9).speed = 10623       : planets(9).name = "pluto"

for a as longint = 1 to 9 
    print planets(a).distance , planets(a).speed , planets(a).name
next

print
print

for a as longint = 2 to 9 step 1
    print (planets(a).distance * planets(a).speed) / (planets(a-1).distance * planets(a-1).speed)  , planets(a).name , planets(a-1).name
next

print
print

for a as longint = 1 to 9 step 1
    print ((29000000*107082)  / ( planets(a).distance * planets(a).speed)) ; " " ; planets(a).name ; " " ; planets(a-1).name
next

sleep 
end

albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

http://www.enchantedlearning.com/subjec ... y/planets/

It appears that the speed of the planets , drops off to the tune of a sine wave. ( instead of a slope. )
http://www.enchantedlearning.com/pgifs/ ... locity.GIF
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Dodicat

How would you make a bar chart of the solar system ?? figuring the screen width is 4,000,000,000 miles across??

"Solar System"

Mercury : 29000000 : 107082
Venus : 67200000 : 78337
Earth : 92000000 : 67000
Mars : 141600000 : 53858
Jupiter : 483600000 : 29236
Saturn : 886700000 : 21675
Uranus : 1784000000 : 15233
Neptune : 2794400000 : 12146
Pluto : 3674500000 : 10623

???
Locked