0

I have been trying to create a library of custom functions that I could just call at the start of every notebook.

For instance, say I want the following functions to be part of the Library, or even be considered by Mathematica as part of the Built-in set of functions

Cofactor[mat_, i_, j_] /; (And @@ Thread[{i, j} <= Dimensions[mat]]) := (-1)^(i + j)* Det[Drop[#, {j}] & /@ Drop[mat, {i}]]; inverseElement[mat_, i_, j_] /; (And @@ Thread[{i, j} <= Dimensions[mat]]) := Cofactor[mat, j, i]/Det[mat];

I haven't been able to find some clear instructions in the documentations on how to do this. I have tried to create an .m file, but then when I use Import to include it to the notebook, functions are not recognized.

usumdelphini
  • 996
  • 4
  • 14
  • Could you be a bit more specific about what's not working? Making a package is a relatively straightforward process once you know what Mathematica is doing and have abandoned any though that it behaves at all like one of the major modern languages. – b3m2a1 Jan 16 '19 at 10:10
  • You can have your code inside the Kernel init.m file which would get evaluated anytime you open a notebook. More details here: https://reference.wolfram.com/language/ref/file/init.m.html – Lotus Jan 16 '19 at 10:12
  • 1

0 Answers0