bigmachine-io / taking-off

93 stars 27 forks source link

Extra Credit Challenge #2

Open slickgit opened 7 years ago

slickgit commented 7 years ago

On the last page of the 'Calculating Orbital Distance' chapter, there's an 'Extra Credit Challenge'. We're supposed to fix the function and correctly apply the orbital term formula. I checked and double checked and can't see what's wrong. I'm sure it's a blatantly obvious thing, but can someone let me know what I'm missing?

clearjs commented 7 years ago

Nope, the task is different. Need to find height for which T = 4h. For that, need to implement the formula in Elixir. The formula itself is correct, and the task to write it down in code is simple, so there was no point for so much fanfare. :)

th31nitiate commented 7 years ago

@clearjs @robconery

This task is not the simple, to be honest...

There are two tasks I need help with:

Orbital acceleration:

I kept getting it wrong I ended up adding precision of 2 and the ignoring everything else past the 9.51 point. I made a mistake in hard coding the value but I wasn't sure what the physics team wanted. The Document mention 9.51 ms2.

Orbital term:

In regards to finding the term I found it quite hard and I was wondering if you could look over my code. I can remove this as it might give some stuff away but I needed a look over because I can't pass this test:

def calc_hieght(time) do
  newtons_gravitational_constant * Planets.earth.mass * (time |> squared)
   / 4 * (:math.pi |> squared)
  |> square_root
  |> cubed #I have tried to calc the vlaue but it didnt work
end

I am getting funky number that don't make sense regardless of whether I convert to_km or not :/ This test won't pass, any help or advice would be much appreciated, I just ignore that test now :(

alpashka commented 7 years ago

@th31nitiate Hey I'm here to help you :) This part of your code is wrong:

|> square_root
|> cubed

You can find the nth root by using

def nth_root(val, n), do: val |> :math.pow(1/n)
# So in your case it will look like this
val |> nth_root(3)

I also stuck at this one for a bit, the thing is that formula works fine but can lead to some misunderstandment because it returns the distance from the center of planet to the orbit and in orbital_term method we are passing distance from the ground to the orbit. If you need more explanations you can refer to this article

PS. my solution

th31nitiate commented 7 years ago

@alpashka thanks just saw this now. I will go back to the task a little later on and test your recommendation. Thank you again.

JasonSoares commented 6 years ago

@th31nitiate

Regarding the first issue:

Orbital acceleration:

I kept getting it wrong I ended up adding precision of 2 and the ignoring everything else past the 9.51 point. I made a mistake in hard coding the value but I wasn't sure what the physics team wanted. The Document mention 9.51 ms2.

I was having the same issue; however, I noticed that the radius used for Earth was different than the one referenced earlier in the book by 1 digit when I went to the linked commit in the book (7c05b129cd6c9bf7fd95a3aadecd0472eb510408).