how to automatically load user-defined functions in mathematica

前端 未结 1 1061
孤城傲影
孤城傲影 2021-02-06 04:58

I have a bunch of user-defined functions that are frequently used in mathematica. I wonder if I can store them in separate files and mathematica will load them on start and trea

1条回答
  •  攒了一身酷
    2021-02-06 05:51

    You can create a package in $UserBaseDirectory/Autoload. This will be loaded at Kernel initialization time.

    Your package should have a Kernel/init.m file

    MyPackage/Kernel/init.m

    Reference documentation on Mathematica packages: http://reference.wolfram.com/mathematica/tutorial/SettingUpMathematicaPackages.html

    DeclarePackage[] is a lazy loading mechanism for symbols and their definitions. The associated package is loaded only when the symbol is used:

    http://reference.wolfram.com/mathematica/ref/DeclarePackage.html

    0 讨论(0)
提交回复
热议问题