58

Introduction This post is long overdue as I have been repeatedly asked to explain code of mine containing these things. As I see increased use of this construct by others perhaps it is past due also. SparseArray objects can behave as functions accepting certain arguments to return internal data or efficiently return data in certain forms. These are known ...


53

The following simulates Mathematica's behaviour after using it for more than 24 hrs. MathLink`CallFrontEnd[FrontEnd`UndocumentedCrashFrontEndPacket[]] Works as advertised! :D


46

Sequential With From Daniel Lichtblau's comment there is a new undocumented syntax for With introduced sometime after version 10.1 that allows: With[{a = 0}, {a = a + 1}, {a = a + 1}, a] 2 Delayed With, Block, and Module These scoping constructs support the use of := in definitions which allows one to handle unevaluated expressions. With[{x := 2 + 2}, ...


40

Funny you should ask :), it turns out there is an undocumented use of Integrate that one can leverage to integrate over regions. Unfortunately this does not seem to work for NIntegrate. This usage is better leveraged in conjunction with some other undocumented functions (see here and here). I will show a few examples of how to use this feature. First, let's ...


37

Internal`PartitionRagged This one has a usage statement! Internal`PartitionRagged[Range[14], {3, 5, 2, 4}] {{1, 2, 3}, {4, 5, 6, 7, 8}, {9, 10}, {11, 12, 13, 14}} Note that Length[list] must equal n1 + ... + nk. (* changed the last 4 to 3 *) Internal`PartitionRagged[Range[14], {3, 5, 2, 3}] Internal`PartitionRagged[Range[14], {3, 5, 2, 3}] Internal`S1,...


36

System` The default value for the overhang parameter k (3rd argument) in ListCorrelate is None. Internal` Predicates Internal`LinearQ[expr, var] yields True if expr is a polynonial of exactly order one in var, and yields False otherwise. Internal`RationalFunctionQ[expr,var] returns True if expr is a rational function of the symbol var, and returns False ...


36

Internal`InheritedBlock What does Internal`InheritedBlock do? Daniel's MathGroup post Strange behaviour of Internal`InheritedBlock How safe is the use of Block and Internal`InheritedBlock Internal`Localizedblock What is the purpose of Internal`LocalizedBlock? Internal`Bag Internal`Bag inside Compile Daniel Lichtblau's answer On the use of of ...


36

To create Experimental`NumericalFunction, one needs to evaluate Experimental`CreateNumericalFunction[vars, expr, dims] where vars is a list of arguments, expr - the expression from which the numerical function will be created, dims - the dimensions of the output matrix produced by this expression. If the output is scalar, then dims should be set to {}. It ...


35

Internal`LocalizedBlock behaves the same as Block, but it can localize non-Symbols (e.g. f[1], Subscript[x, 0], etc.). For example, Internal`LocalizedBlock[{Subscript[x, 0]}, Subscript[x, 0] = 1] (* 1 *) Compare this to Block[{Subscript[x, 0]}, Subscript[x, 0] = 1] (* During evaluation of In[79]:= Block::lvsym: Local variable specification {Subscript[x, ...


34

There is the undocumented option Beveled in the FractionBox FractionBox[a, b, Beveled -> True] // DisplayForm


33

This is a community wiki answer. Feel free to improve it. Introduction RawArray is an atomic array type that can hold data in any of the following formats: "Integer8", "UnsignedInteger8", "Integer16", "UnsignedInteger16", "Integer32", "UnsignedInteger32", "Integer64", "UnsignedInteger64", "Real32", "Real64", "Complex64", "Complex128" (Some aliases can ...


31

Such functions set up a one-time iterator, i.e. a GeneralUtilities`Iterator. Its functionality may be inspected with ? GeneralUtilities`Iterator and so forth. Except for a ConstantIterator which always returns the same value (forever), they go sequentially through values until they return GeneralUtilities`IteratorExhausted. The main (if internal) utility ...


27

Update Leaving my old answer below for historical reference, however as of version 11.2.0 (currently available on Wolfram Cloud and soon to be released as a desktop product) the low-level linear algebra functions have been documented, see http://reference.wolfram.com/language/LowLevelLinearAlgebra/guide/BLASGuide.html The comments by both Michael E2 and J....


27

SatisfiableQ has three methods: "BDD": converts the expression to a BDD (binary decision diagram), "SAT": uses the Minisat library, "TREE": a branch-and-bound method based on the expression tree. SatisfiabilityCount counts instances by converting the expression to a BDD, so its timing should be close to SatisfiableQ with the "BDD" method (counting ...


27

So I have a little bit more info, but mostly a learning technique we can test: Init I wanted to see when each of these was called so I made each possible handler (without a previous assignment) just call Print. Then I found that for "Wolfram.System.Print" this is a terrible idea as it is called anytime the system prints. So I removed that. Here's what I'm ...


27

It seems the model file in MXNet (checkpoint) is defined by two files: a ".json" file and a ".params" file. The json file contains the definition of the network, and the params file contains the actual weight and bias of each neuron. The params file is in the binary format of MXNet's NDArray representation. Thus, to export a network in Mathematica to MXNet, ...


26

Compile`InnerDo This is the one that initially struck me as interesting since I use compiled functions quite a lot. From the documentation of Do: Unless an explicit Return is used, the value returned by Do is Null. But that doesn't seem to be the case for Compile`InnerDo! f1 = Compile[{{x}}, Module[{a}, a = x; Compile`InnerDo[a++, {i, 10^8}]] ...


26

Properties for SparseArray and InterpolatingFunction objects SparseArray objects can accept a range of Properties (or Methods) that allow the efficient extraction of certain information, most commonly "AdjacencyLists" or "NonzeroPositions" as a frequently faster alternative to Position. I started this answer to detail them but as it grew I came to believe ...


26

The details of the styles associated with various themes can be accessed using the function ResolvePlotThemes in the Charting context. For example: Grid[{#, Column@(Charting`ResolvePlotTheme[#, ListPlot] /. HoldPattern[PlotMarkers -> _] :> Sequence[])} & /@ {"Monochrome", "Frame", "Vibrant"}, Dividers -> All] (* removed the part ...


26

We can get old-style messages using Internal`$MessageMenu = False Needless to say, this is unsupported and undocumented functionality.


25

Version 10 introduced some undocumented functionality that makes it easier to explore the style hierarchy. As usual, "undocumented" === "buyer beware". We start by evaluating: StyleManager`OpenStyleManager This does nothing other than trigger the auto-loading of certain symbols. We'll come back to a more interesting use of this symbol later. Now, we ...


25

StringToDouble was renamed StringToMReal as part of code cleanup and the addition of several friends: ?Internal`StringTo* (*Internal`StringToBoolean Internal`StringToMInteger Internal`StringToMReal Internal`StringToMRational*) It should be as fast, but now in failure cases it returns a proper Failure object instead of some bizarro-$Failed[_String]...


23

We can use one of several ways. First, let us create some test data: arr = Range[10]; (* this is an Integer packed array *) unpacked = {1, 2, 3} (* this is an Integer array that is NOT packed *) Since Mathematica 10.4, Internal`PackedArrayType directly returns the type: Internal`PackedArrayType[arr] (* Integer *) Internal`PackedArrayType[unpacked] (* $...


22

One can use Style and FractionBoxOptions to set Beveled: Plot[Sin[x], {x, -2 Pi, 2 Pi}, Ticks -> {Pi Range[-2, 2, 1/2], Automatic}, BaseStyle -> {FractionBoxOptions -> {Beveled -> True}}] It doesn't look too good here, though: This looks ok, Style[3 Pi/2, FractionBoxOptions -> {Beveled -> True}] but not in the "Label" style, Style[...


22

A long comment: Automatic renaming again: ClearAll[F]; F[x_] := Hold[With[{a = x}, {b = x}, a]]; F[0] Hold[With[{a$ = 0}, {b = 0}, a]] I was expecting it already in DownValues, but this is not the case. DownValues @ F {HoldPattern[F[x_]] :> Hold[With[{a = x}, {b = x}, a]]} So who does it? :) Here is a pure guess, if evaluation is really a ...


21

In addition to the error messages quoted in the question the line returns: GeneralUtilities`Benchmarking`PackagePrivate`plot[ IndexBy[{{{16, 9.37132*10^-6}, . . . IndexBy was removed from 10.1.0: Note that IndexBy will be removed in a future version of Mathematica. It was something that was considered for 10.0.0 but didn't make the cut. – Stefan R Feb ...


21

Intro One day I was playing with Developer` package and found DateSetter which uses some kind of floating elements that I found useful. After taking a look at a source code I found out it was FrontEnd`AttachedCell. From the code one could learn enough to create something useful: Usage FrontEnd`AttachCell[ parentObject, (*Box or Cell ...


20

System`Private`*Entry* functions Since version 10.0 System`Private`SetNoEntry and System`Private`EntryQ functions are available. System`Private`SetNoEntry Changes internal representation of given expression so that it is considered atomic, it returns "atomized" version of expression. This change affects all references to given expression, but not new ...


19

No, there are no more built-in generators. In this case, the SeedRandom::nogen message can be regarded as definitive. The list it prints is not predefined, but a runtime enumeration of all existing system random number generators. A couple of these are indeed undocumented: "Rule50025CA" is cellular automaton based and similar to "ExtendedCA" but using a ...


19

In my view, the Mathematica front end would have needed a complete rewrite a long time ago to be in a shape where it can compete with modern UI's. Looking at MATLAB, it's clear that you always find things that are even more out-of-date. Also, I don't want to say that you can't create beautiful content inside a notebook. However, especially the capabilities ...


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