0
$\begingroup$

The package modt

BeginPackage["modt`"];   
SIRsh;
Begin["`Private`"];
SIRsh=Module[{S,Vg,var}, var= {s, i, v};
    S={{\[Mu] N,-\[Beta]/Nv,0,      -\[Mu],0,0},
       {0,  \[Beta]/Nv,0,       0,-\[Mu]i,0},
       {0,  0,  -\[Beta]v/N,   0,\[Beta]v Nv/N,-\[Nu]}};
    Vg={1,g[s,v],h[i,v], s  ,i , v }; 
    {S,Vg}
    ];
End[];
EndPackage[];
$ContextPath = DeleteDuplicates[Append
[$ContextPath, "modt`Private`"
    ]]

includes a script which introduces in var= {s, i, v} three local variables s,i,v. For some reason, v is interpreted differently from s,i and later when I call it

<<modt.wl;
    Vg=SIRsh[[2]]
    var={s,i,v}

I get warning messages like Globalv::shdw: Symbol v appears in multiple contexts {Global,modsPrivate}; or g[s, modtPrivatev] which warn me about v, but not about s,i. What could be the difference?

$\endgroup$
5
  • 1
    $\begingroup$ Works for me. Start a new kernel and try again. $\endgroup$ Feb 7 at 13:12
  • $\begingroup$ I restarted (5 times) but still I got {1, g[s, modtPrivatev], h[i, modtPrivatev], s, i, modtPrivatev}, and v is in red. To be sure, I quit Mathematica. Still, v is seen differently than s,i on my 13.3 $\endgroup$
    – florin
    Feb 7 at 13:18
  • 1
    $\begingroup$ I have 14.0. Maybe that is the reason. $\endgroup$ Feb 7 at 16:15
  • $\begingroup$ At least it works almost fine if I take the script out of the package and add it where I use it. v is still in red (with no error message!), but the results are fine $\endgroup$
    – florin
    Feb 8 at 2:47
  • 1
    $\begingroup$ Glad to hear this. :) $\endgroup$ Feb 8 at 8:05

0

Your Answer

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

Browse other questions tagged or ask your own question.