# Tag Info

23

Typically, Mathematica contacts the license server every 2 minutes. If you have a license which supports a very large number of processes, that interval can grow (to help MathLM to scale better). It will never be more than 30 minutes. If three consecutive license checks fail, then Mathematica will instead revalidate the entire license file on what would ...

20

Version 10 It is time to start setting up bug fixes and work-arounds for version 10. Fix TableAlignments -> Left not working -- code too long to include; provided in answer there Fix 10.0.2 mapping Association to Dataset warning: Begin["TypeSystemInferencePackagePrivate"]; exprType[e_Association] := If[AssociationQ@Unevaluated@e, ...

14

Maybe NotebookDynamicExpression is what you are looking for: SetOptions[EvaluationNotebook[], NotebookDynamicExpression :> Refresh[ SetDirectory[NotebookDirectory[]]; nbs = {"one.nb", "two.nb", "three.nb"}; For[i = 1, i <= Length[nbs], i++, Block[{nb = NotebookOpen[NotebookDirectory[] <> nbs[[i]]]}, FrontEndTokenExecute[nb, ...

12

You can use the global AutoOpenNotebooks setting to give a list of notebooks that must be opened on startup. The default path where it looks for these notebooks is $UserBasedirectory/SystemFiles/FrontEnd/TextResources. Now every time you open Mathematica, that notebook will be opened (in my case, tile.nb). 11 I don't know anything about mathStatica, so I can't comment on specifically what it's doing. But I can comment on the various moving parts of the system. The init.m file is created by the paclet manager. It must be that the mathStatica palette is part of a paclet which is under active management by the paclet manager. The paclet manager, as part of its ... 11 There are two typical locations where a user can add an init.m file to be loaded at run-time:$BaseDirectory and $UserBaseDirectory.$BaseDirectory is useful for installation wide customizations that apply to all users while $UserBaseDirectory is used for a specific users customizations. So, anything in$UserBaseDirectory is loaded after the files found in ...

10

Here is one that came from a Wolfram employee so it should be safe to add in version 9: FindInstance returns Indeterminate in version 9, but not in 8

10

I think I found it but I'd be more than happy to look at other alternatives if any provided: Shift + Ctrl + O to open Options > Notebook options > Evaluation options > Global preferences from the drop down menu at the top Change InitializationCellEvaluation to True and InitializationCellWarning to False The next time the .nb file is launched, the ...

9

Cause The problem is due to a bug involving Catch and init.m that occurs in (at least) Mathematica versions 7, 8 and 9. It has been reported to Wolfram Support and they have acknowledged it as a bug. At time of writing, WRI has offered neither diagnosis nor workaround for this problem. Reproduction Steps and Analysis To reproduce the issue, place the ...

8

mathStatica does not alter, nor seek to alter, the MenuSortingValue. In fact, mathStatica does not alter or seek to alter, in any way, how or where the mathStatica palette is listed in the palette menu... this is left entirely to default Mathematica behaviour. The reason the mathStatica palette appears out of alphabetical order in the Palettes menu seems to ...

8

As J.M. pointed out, this can be achieved by using an init.m file. init.m files are loaded on startup. The documentation can be found here. To load the VectorAnalysis package on each startup, you can write the init file using Export. The snippet below will append a Needs["VectorAnalysis"] to the kernel init.m file: initFileName = ...

8

Here's a patch from Adam Strzebonski of Wolfram, which fixes a bug in RootReduce in 9.0.1. ToNumberField won't recognize Root as explicit algebraic number

8

I think that Mike has a point: it is always good to start with something simple. Here is a very simple example which shows the main problem you have: the Initialization-code is evaluated only after the body of the DynamicModule has been evaluated. This might be surprising considering its name but I think is in agreement with the documentation, which is ...

8

One way to go about this is read in the file names - this way you don't have to explicitly check to see if they exist. path = SystemDialogInput["Directory", NotebookDirectory[]]; fileNames = FileNames["*.txt", path]; allFiles = Table[Import[fileNames[[num]]], {num, 1, Length[fileNames]}]; This reads the names of all files (in the specified path ...

7

I think it is more convenient to use NotebookEvaluate. We can do NotebookEvaluate[filename, EvaluationElements-> "InitializationCell"] Confusing here may be that this has the same result as NotebookEvaluate[filename, EvaluationElements -> Automatic] Even though if we simply do NotebookEvaluate[filename] all the cells get evaluated.

7

This is possible, at least in version 7, but as rcollyer supposed there is a Global security option which cannot be set from within the Notebook (automatically, that is). First change the Global option: SetOptions[$FrontEnd, GlobalInitializationCellWarning -> False ] Then in the Notebook you need: SetOptions[EvaluationNotebook[], ... 6 Take a look at: Programmatically quitting the FrontEnd or running without one? I asked some similar questions and the answers have some good strategies to do this although most of them as workarounds outside of the Mathematica front end. A simple but key thing, adding NotebookSave[] to the end of your initializations cell can avoid some of the ... 6 A bit of an extended comment, but using a package makes all the sense in the world for a situation like you describe. You can see a specific example at this earlier question: What is a good coding style for setting and changing application level constants? In the above answer, a package provides a way to supply constants to any other notebooks. While ... 5 I'm questioning AND answering this because I was looking for a feature like this for a while and now stumbled across FrontEndToken["EvaluateInitialization"] which does exactly what I wanted. Here is the code to make it work: filename = SystemDialogInput["FileOpen"]; nb = NotebookOpen[filename]; FrontEndExecute[FrontEndToken[nb, "EvaluateInitialization"]]; ... 5 According to the documentation, To suppress the loading of kernel initialization files, use the kernel command-line option -noinit. To specify another file to be used for kernel initialization in addition to init.m, use the kernel command-line option -initfile file, where file is the additional initialization file. 4 This has to do with the Notebook's default context setting in the evaluation menu. If it isn't set to Global, the definitions made in init.m are not seen. As rm-rf says, a good way to put custom definitions in the init.m would be to use Begin and End to create an Init context and append that context to the context path so that the definitions are ... 3 This is too long for a comment. I don't really have time to pull this code apart but if the objective is to learn DynamicModule wouldn't a simpler piece of code be a better start? If you look at what variables have been created after the first ENTER this is a small sample of what you get I think it would be best to pull your code apart and figure out why ... 3 It's probably a good idea to look at this question more more information about writing CDF-happy notebooks. In brief, Initialization cells won't function properly in the CDF format. For example if we have the following initialization cell: a = 1; And subsequent cell that is not an initialization cell Manipulate[b + x, {x, 1, 10, 1}] Manipulate[a + x, ... 3 On Mathematica 7 (at least) DeclarePackage doesn't work first time on this Curl example: DeclarePackage["VectorAnalysis", {"Div", "Grad", "Curl"}] v := {3 Xx^2 + 2 Yy + (a - 3 b) Zz, (b - 7 a) Xx - 5 Yy - Zz, 2 Xx + c a Yy + 7 Zz} Curl[v] {0, 0, 0} But strangely when v is defined again and run it works: v := {3 Xx^2 + 2 Yy + (a - 3 b) ... 3 You can run SetDirectory in the kernel initialization file, init.m. You'll find it here: SystemOpen@FileNameJoin[{$UserBaseDirectory, "Kernel"}]

3

2

This question seems to be slightly different from Globally loading packages while using a CellGroup as the default context (which I just posted an answer for). Probably the simplest method would be to define your init.m functions in the System context itself as this is always accessible no matter the CellContext. For example: Systemhex[n_] := ...

2

One possibility would be to (programmatically) add dynamic options to all cells. E.g., one cell could look like : Cell["1-1", "Input", Evaluatable->Dynamic[eval], CellOpen->Dynamic[open], Background->Dynamic[bcolor]] Then, if you evaluate in a subsequenc cell (or by Button) this: eval = True; open = True; bcolor = LightGray the Cell becomes ...

2

As I understand, three things are needed: Explicitly list the contexts of the functions that are in the package. For example, if you are using the function f in package test call it testf[] instead of just f[]. Call Needs on the package inside the initialization option for the Manipulate that makes up your CDF. I would recommend calling needs with the ...

1