Tag Info

New answers tagged

0

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 ...


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[] ...


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 ...


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]], ...


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).


0

It seems needlessly complex to write If[Boole[IntegerQ[x/10000]] == 0, N[x/10000], IntegerPart[x/10000] when If[IntegerQ[x/10000], IntegerPart[x/10000], N[x/10000] ] would do. (Notice that the arguments are reversed because you are now checking if IntegerQ is true, not false.) I do not have the customticks package, but I suspect your problem is that ...


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 ...


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" *) ...


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

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 (* ...



Top 50 recent answers are included