我正在寻找一种从轨道参数(周期、偏心、半轴.)中检测的方法.有共鸣的行星。
我知道,如果两颗行星之间的比例是可通约的,这就意味着它们在共振,但假设我想知道它们在哪一种共振中,我该如何做呢?
例如,我有N个行星和周期的矩阵。我如何创建一个循环来检查行星是否和在哪一种共振中存在?
类似于:
for i=1, N
P(i)/P(i-1)=m
if m (check the resonance condition) then
write (planets parameters)
end if
end for非常感谢。
我制作这个程序,我有一个2xN矩阵,其中列是行星的ID和它们的周期,行是行星的数目,例如:
1 0.44
1 0.8
1 0.9
2 0.9
2 1.2
3 2.0
3 3.0从一个行星系统改变到另一个行星系统的诀窍是将一个系统的所有行星重新命名为相同的数目,把其他系统的行星重新命名为另一个数字,这样我就可以将共振条件从一个系统更改为另一个系统。
这个程序很简单:
name和period作为矢量保存,for r=1,row <--- THIS MUST READ all the file
if (difference in name = 0.) then start the resonance find criterion
for l = 0,4 (number of planet in each system: THIS MUST BE MODIFIED !!)
for i = 1,5
for j = 1,5
if (i*period(l)-j*period(l+1) eq 0) <- RESONANCE CONDITION !!!
then write on file
end for
end for
end for
else write a separation between the first set and second set of planets !
end for这是我编写的IDL代码:
pro resfind
file = "data.dat"
rows =File_Lines(file) ; per le righe
openr,lun,file,/Get_lun ; per le colonne
line=""
readf,lun,line
cols = n_elements(StrSplit(line, /RegEx, /extract))
openr,1,"data.dat"
data = dblarr(cols,rows)
readf,1,data
close,1
name = data(0,*)
period = data(1,*)
openw,2,"find.dat"
for r = 0, rows-2 DO BEGIN ;
if (name(r)-name(r+1) EQ 0) then begin
for l = 0,rows-2 do begin
for j = 1,4 do begin
for i = 1,4 do begin
if (abs(i*period(l)-j*period(l+1)) EQ 0.) then begin
printf,2, 'i resonance:', i , ' j resonance:',j,' planet ID:',l,' planet ID:',l+1
endif
endfor
endfor
endfor
endif else begin
printf,2, ' '
endfor
close,2
end问题:
发布于 2014-03-29 09:29:07
首先,每个实数都可以表示为任意有限精度的整数的比率。当我们在十进制中用越来越多的数字来表示数字时,这就是我们要做的。所以,你不仅需要检查轨道周期是否在某种整数比中,还需要检查这两个整数是否相对较小。这是一个武断的决定,是“小”的。
第二,记住两个浮点值通常是不同的,如果其中一个不是另一个的副本。例如,3*(1/3)可能不等于1,这是有限精度的结果:当以二进制表示时,1/3是无限重复的,所以当存储在内存中时,它会被截断。所以你不应该检查周期比率是否等于某个比率,而是它是否足够接近某个比率。直截了当地说什么“够近了”。
因此,最快的方法是为一些相对较小的整数构建一个比率数组,然后对其进行排序并删除重复项(3:3 = 2:2,并且不需要数组中的多个整数)。(请记住,副本并不等于每个oher,而是足够接近对方的那些。)然后,对每两颗行星计算轨道周期比率,并在表中搜索最接近的值。如果距离足够近,你就能找到共鸣。
https://stackoverflow.com/questions/22724822
复制相似问题