Implement a function to calculate the cosine similarity between two high-dimensional vectors from scratch.
Implement cosine_similarity(vector_a, vector_b). The inputs are equal-length arrays of real numbers. Return the scalar dot(vector_a, vector_b) / (norm(vector_a) * norm(vector_b)). If either vector has zero magnitude, return 0.0 because its direction is undefined. Do not use a machine-learning or numerical library.
def cosine_similarity(vector_a, vector_b):