0
$\begingroup$

I wanted to ask a simple question. I am new to Mathematica, and I don`t find a way to call user defined functions just as I call Mathematica functions.

I want to use my own defined functions, but call them from different notebooks without including them in each notebook.

Is it possible? Thanks!

$\endgroup$
  • 1
    $\begingroup$ Add your function definitions to the init.m file. $\endgroup$ – Bob Hanlon Feb 10 '16 at 17:52
  • $\begingroup$ (8221) $\endgroup$ – Mr.Wizard Feb 10 '16 at 18:04
2
$\begingroup$

One way to do it is the following. Evaluate in a Mathematica notebook the following

$UserBaseDirectory <> "/Kernel"

Go to the corresponding file and create through Mathematica (if it is not already existing) an init.m file with your definitions e.g.

whateverFunct[x_]:=3x+5;
$\endgroup$
  • $\begingroup$ Thanks it helps a lot (sorry for the duplicate, I hadn't found it) $\endgroup$ – Miguel Feb 10 '16 at 20:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.