# function from .wl produces no output [duplicate]

I'm trying to learn to reuse functions. I have created a .wl file with the following content. As I understand the last line without semicolon is the function output. Should each function have it's own block of Begin[] and End[]?

BeginPackage["vectorFunctions"]

Begin["Private"] (* Begin Private Context *)

vectorDeriv::usage="
vectorDeriv[v_,bc_Integer]
";
(* The function works fine if declared in the notebook. *)
vectorDeriv[v_,bc_Integer] :=
(
vFFirstDer = D[v,{t}];
vFSecondDer = D[v, {t,2}];
vFFirstDerNorm = N[Norm[vFFirstDer] /. t -> bc];
vFSecondDerNorm = N[Norm[vFSecondDer] /. t -> bc];
{vFFirstDer, vFSecondDer, vFFirstDerNorm, vFSecondDerNorm}
)
End[] (* End Private Context *)
EndPackage[]


When I try to call the function from the notebook I get no output.

 (* the path is correct *)
In[39]:= Get["C:\\Program Files \
(x86)\\MyJournal\\Images\\Math_Physics_Library\\vectorFunctions.wl"]

Out[39]= "vectorFunctionsPrivate"

In[40]:= vF = {Sin[2 t], E^(3 t), t^3 - 4 t};

In[41]:= vectorDeriv[{Sin[2 t], E^(3 t), -4 t + t^3}, 2]

Out[41]= vectorDeriv[{Sin[2 t], E^(3 t), -4 t + t^3}, 2]


Am I missing something with the Private vs Public scope? Should modules be kept in only Mathematica's running directory?

• You do not need to create a package with BeginPackage etc. to simply re-use function definitions. It is sufficient to put the definitions into an .m or .wl file and load them with Get. Get just evaluates whatever is in your file—it does nothing more and nothing less. – Szabolcs Sep 7 '17 at 21:08
• Can you format the question for readability? You have already asked many questions on StackExchage, so I am sure you are familiar with how to do this. – Szabolcs Sep 7 '17 at 21:09
• If you are asking how to create proper packages (not just re-use a few definitions), then it is a duplicate of (29324). – Szabolcs Sep 7 '17 at 21:13
• The problem is that vectorDeriv is not mentioned between BeginPackage and Begin`. See the post about creating packages I linked above (also this answer). – Szabolcs Sep 7 '17 at 21:22
• Another problem will be: mathematica.stackexchange.com/q/114769/5478 – Kuba Sep 7 '17 at 21:28