Mathcad has the ability to define user functions. Go to Help | Developer's Reference.
The help defines the process in a simple and adequate manner.
You can create a DLL user function. They are kept globally in the Mathcad/userefi directory of the Mathacd installation and accessible to any worksheet.
Two samples DIGAMM and KRONECKR are provided.
It is found in the use
The other way to define global functions is to program them in Mathcad in a separate file. You can at the top of any new file reference in the global functions file.
I do this with a custom file that defines some functions and units.
You use Insert | Reference on the toolbar.
A dialog box opens where you identify the file and insert the reference file.
Any variables, units, functions in the reference file are now available in the new file.