0

I've been having quite a bit of trouble loading a package I wrote. I've followed the suggestions on related questions on this site, as well as on Mathematica's own pages, and still nothing has worked. This is my package code:

BeginPackage["errorpropagation`"]
(* General error propagation formula *)

fError::usage = 
  "Calculate the error in a function f[{x1,x2,...}] with uncertainties {dx1,dx2,...}."

Begin["`Private`"]

fError[f_, xi__, dx__] := 
  Sum[(D[f[xi], xi[[i]]]*dx[[i]])^2, {i, 1, Length[xi]}]^(1/2);

fErrorTest[x_] := Module[{a = 3}, x^3 - a];

End[]

EndPackage[]

And then I try to load it as such:

<< pathToFile/errorpropagation.m
g[{x_, y_}] := x^2 + x y;
fError[g, {x, y}, {dx, dy}]
fErrorTest[3]

I've tried different variants of whether the << command takes a string or not, and relative and full path names, but had no success. The package has worked for me if I open it and evaluate the cells in the package, but the whole point of writing a package was to avoid manual evaluation every time.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
user1748343
  • 43
  • 1
  • 1
  • 4

0 Answers0