Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

I made a package containing some functions in the following way.

BeginPackage["diagram`"];
Begin["`Private`"];
Print["All triangle and fishing diagrams"];
reg[ma_, g1A_, g2A_, g3A_, g1Z_, g2Z_, g3Z_, mh_, mz_] := 
   1/(15360 ma^4 π^2) (60 (5 g2Z g3A - 4 g2A g3Z) gμν ma^4 - 
       10 ma^2 ((-3 g2Z (g2A + g3A) - (7 g2A + 3 g3A) g3Z + 
             12 g1A (2 g2Z + g3Z)) gμν mh^2 - 
          3 (g2Z (8 g1A + g2A - 3 g3A) + (4 g1A - 3 g2A + g3A) g3Z) gμν mz^2 + 
          12 g1Z (g2A + 2 g3A) (gμν (mh - mz) (mh + mz) - 2 pνqμ) - 
          6 (g2Z (8 g1A - 3 g2A + g3A) + (4 g1A + g2A - 
                3 g3A) g3Z) pνqμ) ϵ^2 + (gμν (-(3 g2A g2Z + 
                 22 g2Z g3A - 14 g2A g3Z + 3 g3A g3Z) mh^4 - (3 g2A g2Z + 73 g2Z g3A - 
                7 g2A g3Z + 3 g3A g3Z) mh^2 mz^2 + (9 g2Z g3A + 5 g2A g3Z + 
                4 g3A g3Z) mz^4) + 
          5 g1A ((2 g1Z + 3 g2Z - g3Z) mh^2 + (-10 g1Z + 9 g2Z + 
                g3Z) mz^2) (gμν (mh - mz) (mh + mz) - 2 pνqμ) + 
          2 ((9 g2A g2Z - 44 g2Z g3A + 4 g2A g3Z + 9 g3A g3Z) mh^2 + 
             3 (4 g2A g2Z - g2Z g3A - g2A g3Z + 4 g3A g3Z) mz^2) pνqμ + 
          5 g1Z (gμν (-(g2A - 3 g3A) mh^4 + 4 (-2 g2A + 3 g3A) mh^2 mz^2 - 
                3 (g2A + g3A) mz^4) + 
             2 ((g2A - 3 g3A) mh^2 + (-11 g2A + 
                   5 g3A) mz^2) pνqμ)) ϵ^4 - 
       40 (18 (g2A (g2Z - g3Z) + g3A (2 g2Z + g3Z)) gμν ma^4 + 
          ma^2 (-(3 g2A g2Z + 29 g2Z g3A - 3 g2A g3Z + 
                 3 g3A g3Z) gμν mh^2 + (18 g1Z (-g2A + g3A) - 
                g2Z (g2A + 5 g3A) + (5 g2A + g3A) g3Z) gμν mz^2 + 
             4 (3 g2A g2Z - g2Z g3A + 
                3 g3A g3Z) pνqμ) ϵ^2 + (gμν ((3 g1A g1Z + 
                   2 g2Z g3A) mh^4 - (g1A (4 g1Z + g2Z) + (g1Z - 
                    2 g2Z) g3A) mh^2 mz^2 + (2 g1Z g2A + g1A (g1Z + g2Z) - g1Z g3A + 
                   g2Z g3A) mz^4) + 
             2 ((-3 g1A g1Z + 2 g2Z g3A) mh^2 + (3 g1Z g2A + g1A (g1Z + g2Z) - 2 g1Z g3A +
                    g2Z g3A) mz^2) pνqμ) ϵ^4) Log[
         ma/μ]) /. {g1A -> -g1A, g1Z -> -g1Z}; /. {ϵ -> φ}
reg[ma_, g1A_, g2A_, g3A_, g1Z_, g2Z_, g3Z_, mh_, mz_] := 
   1/(15360 ma^4 π^2) (60 (5 g2Z g3A - 4 g2A g3Z) gμν ma^4 - 
       10 ma^2 ((-3 g2Z (g2A + g3A) - (7 g2A + 3 g3A) g3Z + 
             12 g1A (2 g2Z + g3Z)) gμν mh^2 - 
          3 (g2Z (8 g1A + g2A - 3 g3A) + (4 g1A - 3 g2A + g3A) g3Z) gμν mz^2 + 
          12 g1Z (g2A + 2 g3A) (gμν (mh - mz) (mh + mz) - 2 pνqμ) - 
          6 (g2Z (8 g1A - 3 g2A + g3A) + (4 g1A + g2A - 
                3 g3A) g3Z) pνqμ) ϵ^2 + (gμν (-(3 g2A g2Z + 
                 22 g2Z g3A - 14 g2A g3Z + 3 g3A g3Z) mh^4 - (3 g2A g2Z + 73 g2Z g3A - 
                7 g2A g3Z + 3 g3A g3Z) mh^2 mz^2 + (9 g2Z g3A + 5 g2A g3Z + 
                4 g3A g3Z) mz^4) + 
          5 g1A ((2 g1Z + 3 g2Z - g3Z) mh^2 + (-10 g1Z + 9 g2Z + 
                g3Z) mz^2) (gμν (mh - mz) (mh + mz) - 2 pνqμ) + 
          2 ((9 g2A g2Z - 44 g2Z g3A + 4 g2A g3Z + 9 g3A g3Z) mh^2 + 
             3 (4 g2A g2Z - g2Z g3A - g2A g3Z + 4 g3A g3Z) mz^2) pνqμ + 
          5 g1Z (gμν (-(g2A - 3 g3A) mh^4 + 4 (-2 g2A + 3 g3A) mh^2 mz^2 - 
                3 (g2A + g3A) mz^4) + 
             2 ((g2A - 3 g3A) mh^2 + (-11 g2A + 
                   5 g3A) mz^2) pνqμ)) ϵ^4 - 
       40 (18 (g2A (g2Z - g3Z) + g3A (2 g2Z + g3Z)) gμν ma^4 + 
          ma^2 (-(3 g2A g2Z + 29 g2Z g3A - 3 g2A g3Z + 
                 3 g3A g3Z) gμν mh^2 + (18 g1Z (-g2A + g3A) - 
                g2Z (g2A + 5 g3A) + (5 g2A + g3A) g3Z) gμν mz^2 + 
             4 (3 g2A g2Z - g2Z g3A + 
                3 g3A g3Z) pνqμ) ϵ^2 + (gμν ((3 g1A g1Z + 
                   2 g2Z g3A) mh^4 - (g1A (4 g1Z + g2Z) + (g1Z - 
                    2 g2Z) g3A) mh^2 mz^2 + (2 g1Z g2A + g1A (g1Z + g2Z) - g1Z g3A + 
                   g2Z g3A) mz^4) + 
             2 ((-3 g1A g1Z + 2 g2Z g3A) mh^2 + (3 g1Z g2A + g1A (g1Z + g2Z) - 2 g1Z g3A +
                    g2Z g3A) mz^2) pνqμ) ϵ^4) Log[
         ma/μ]) /. {g1A -> -g1A, g1Z -> -g1Z}; /. {ϵ -> φ}
End[]
EndPackage[]

Then I opened a notebook and tried to load the package.

Get["/home/bithika/Dropbox/EWP - higgs/Nb_Bithika/CURRENT/WF/diagram.m"]

However, when I type

?reg 

I get the following error

Information::notfound: Symbol reg not found. >>

Why is the function not loading?

share|improve this question

marked as duplicate by Mr.Wizard Aug 28 '13 at 19:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Please, take a look here to improve your code formatting practices. –  Sektor Aug 28 '13 at 18:10
    
Very much related and good reading in the answers: mathematica.stackexchange.com/q/29324/131 –  Yves Klett Aug 28 '13 at 18:37

1 Answer 1

You need to expose reg prior to Begin.

BeginPackage["diagram`"];
reg
Begin["`Private`"];
...
End[]
EndPackage[]

See the example here: http://reference.wolfram.com/mathematica/tutorial/SettingUpMathematicaPackages.html

under "standard sequence of context control commands in a package".

share|improve this answer

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