Obviously, Plus[a,b] is given by Mathematica but say I have a package and I want to name a function Plus[a,b]. How can I go about making a new function without overwriting the original function Plus[a,b] given from System. I figured it might be something like this:


Test`Plus::usage = "Plus[a_,b_] gives..."

(* function defs *)
Test`Plus[a_,b_] := ...


Or maybe it has something to do with Unprotect[]? Ideally, I could still type in Plus[a,b] and make use of the system function but I could also type in


to make use of the new Plus function from the package. Thanks

EDIT: in response to Marius Ladegård Meyer Is this what you are suggesting I do?


Plus::usage = "asdf"

Plus[a_,b_] := adfasf


And then I can use Test`Plus?

  • $\begingroup$ I think Begin/End and BeginPackage/EndPackage are the way to go here. Using Unprotect on such a central function as Plus is an extremely bad idea, since it will modify a huge number of other (behind the scenes) Mathematica functions. $\endgroup$ Jun 25, 2020 at 19:13
  • $\begingroup$ Sorry, what do you mean Begin/End? Like Begin["`Private`"] or something? $\endgroup$
    – Brandon
    Jun 25, 2020 at 19:15
  • 2
    $\begingroup$ Yes. Have you seen this Workflow guide? $\endgroup$ Jun 25, 2020 at 19:18
  • $\begingroup$ So then are you saying this is what I need? (see edit in post) $\endgroup$
    – Brandon
    Jun 25, 2020 at 19:28
  • 3
    $\begingroup$ The best practice here is to call your function something other than Plus. $\endgroup$
    – QuantumDot
    Jun 25, 2020 at 20:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.