Include("<file_name.jl"> does not include everything


#1

I have a file, coordinate_transformations.jl that define three functions:

 function coordinate_transformation_e_frame_to_b_frame(vector, q0, q1, q2, q3)
 q0 = q[1]
 q1 = q[2]
 q2 = q[3]
 q3 = q[4]

 C_eb =
 [ q0^2+q1^2-q3^2-q3^2	2*(q1*q2 + q0q3)	2(q1*q3 - q0*q2);
   2(q1*q2 - q0*q3) 	q0^2-q1^2+q2^2-q3^2	2(q2*q3 +q0*q1);
   2(q1*q3 + q0*q2)	2(q2*q3 - q0*q1)	q0^2-q1^2-q2^2+q3^2] 


 rotated_vector = C_eb*vector 
 end

 function coordinate_transformation_b_frame_to_e_frame(vector, q0, q1, q2, q3)
 q0 = q[1]
 q1 = q[2]
 q2 = q[3]
 q3 = q[4]

 C_be =
 [ q0^2+q1^2-q3^2-q3^2	2(q1*q2 - q0*q3)	2(q1*q3 + q0*q2);
   2*(q1*q2 + q0q3) 	q0^2-q1^2+q2^2-q3^2	2(q2*q3 - q0*q1);
   2(q1*q3 - q0*q2)	2(q2*q3 +q0*q1)		q0^2-q1^2-q2^2+q3^2]

 rotated_vector = C_be*vector
 end

 function coordinate_transformation_n_frame_to_b_frame(vector, Psi, Theta, Phi)
   C_nb = 
   [cos(theta)*cos(psi) 					cos(theta)*sin(psi) 					-sin(theta);
   sin(phi)*sin(theta)*cos(psi)-cos(phi)*sin(psi)	sin(phi)*sin(theta)*sin(psi) + cos(phi)*cos(psi)  	sin(phi)*cos(theta);
   cos(phi)*sin(theta)*cos(psi) + sin(phi)*sin(psi) 	cos(phi)*sin(theta)*sin(psi)- sin(phi)*cos(psi) 	cos(phi)*cos(theta)]
  
   rotated_vector = C_nb*vector 
  
   return rotated_vector
 end

When I use

 include("coordinate_transformations.jl")

in REPL it only recognize the last function definition

 julia> include("coordinate_transformations.jl")
 coordinate_transformation_n_frame_to_b_frame (generic function with 1 method)

Why are not the other two functions recognized and defined in the present scope?


#2

Please update your post using triple back quotes ` around the code-blocks. It will the use mono-space font and syntax highlighting. The style you used is for quotes.


#3

What makes you say they are not?


#4

When you call include, it returns the result of the evaluation of the last code block in the file, which in your case is the function definition of coordinate_transformation_n_frame_to_b_frame.

The rest of the functions defined in the file will be defined in the current scope.

Cheers,
Kevin