Displaying 1 result from an estimated 1 matches for "star1mass".
2008 Oct 20
2
R Newbie Question
...rs "cancel out", e.g. an
object would not be attracted to any star. Well, enough background
information, here's my rookie code - please feel free to comment on
anything :-)
Kind regards,
Johannes
star1center = vector("numeric", 2)
star1center[1] = -0.5
star1center[2] = 0
star1mass = 30
star2center = vector("numeric", 2)
star2center[1] = 0.5
star2center[2] = 0
star2mass = 1
sqr = function(x) {
return(x * x)
}
distance = function(a, b) {
return(sqrt(sqr(a[1] - b[1]) + sqr(a[2] - b[2])))
}
len = function(x) {
return(sqrt(sqr(x[1]) + sqr(x[2])))
}
norm = functi...