Tag Info

Hot answers tagged

8

You'll want to manipulate $ContextPath. The following will do: removeCombinatorica[] := ( oldContextPath = $ContextPath; $ContextPath = DeleteCases[$ContextPath, "Combinatorica`"]; ) readdCombinatorica[] := ($ContextPath = oldContextPath;) Then you can call removeCombinatorica[] before whatever you want to ignore Combinatorica, and readdCombinatorica[] ...


6

Only initialization cells will be saved as uncommented code. Check Cell -> Cell Properties -> Initialization Cell and Initialization Group. You can also use Code cells (instead of Input), which have the Initialization Cell property by default. Alt-8 or Command-8 inserts a code cell. You can check that it is an initialization cell by looking at the top ...


5

In general, packages need to be placed in the Applications directory within $UserBaseDirectory. $UserBaseDirectory has different locations on different systems. With standard Mathematica, we can just evaluate $UserBaseDirectory to find this location, e.g. on a Windows system: $UserBaseDirectory (* "C:\\Users\\JoeUser\\AppData\\Roaming\\Mathematica" *) ...


5

Check the SimpleArithmetic.m file and make sure that the code is not commented out. A technique that works is to name the notebook SimpleArithmetic.nb. Take the lines that you have copied and make them individual cells (one for each command) rather than a single cell. Set all of their properties to Initialization Cell. You can select them all (ctrl-A) and ...


5

If you define Diff in a private context, like BeginPackage["Diff`"] Diff::usage = "" Begin["`Private`"] Diff[yy_] := Module[{cc}, cc = D[yy, x[1]]; cc]; End[] EndPackage[] then you will get << Diff` Diff[x[1]^2] (* 0 *) That's because the x referred to in the package is in the Diff`Private` context: Definition@Diff // InputForm (* ...


3

It turns out the problem was related to the context: Apparently, the placeholder needs to be specified as Global`\[Placeholder] when used in a package (after BeginPackage).


3

? name is a special input form with nonstandard parsing behavior, just like >>> as explained here. When you write a line starting with ? the item following it is not a Symbol, contrary to appearances. Instead it is a String with implicit delimiters. This is not simply a matter of a hold attribute. For example HoldComplete[a^] is incomplete ...


2

I do not think this a bug, but more of a peculiarity of paclet manager. This sort of thing happens when a package isn't loaded and a function it defines is mentioned. This what I think happened. At the time you evaluated In[1], VariationalD was an undefined symbol, because the VariationalMethods package wasn't loaded. Which is what the message you got told ...


1

All cells in a notebook saved as a .m file which is intended to be loaded with Get or Needs must be initialization cells.


1

You can run Begin["Mypackage`Private`"], then call myFunction[x] and any other private functions, followed by End[] in your test notebook or .mt file instead of commenting it in the package. This way you don't need to modify your package, you only need to write out the context once and it will work the same way every time you run the code, regardless of ...


1

This is very similar to a common problem that many symbolic Mathematica functions share, e.g.: Solve[2*x-5==15,x] and as can be seen from the example the standard way to solve that is to pass such symbols which are to be used as formal symbols as extra argument(s). As you guessed in your comment the most direct way to implement that would be something ...


1

Maybe try If[! TrueQ[SQLConnectionUsableQ[XxSQLConnection]], ...



Only top voted, non community-wiki answers of a minimum length are eligible