Tag Info

Hot answers tagged

38

The short answer is, yes! There is a whole undocumented package TemporalData` containing some useful functions. The results below are from my own spelunking. Feel free to add/amend as appropriate. Let's set up some simple TemporalData objects to explore them: fakedata = Transpose@{DatePlus[{2001, 1}, {#, "Month"}] & /@ Range[0, 99], ...


30

Internal`InheritedBlock (IIB) is similar to Block, except that it preserves the original definition of the function being passed to it. The function can then be modified as we wish inside the IIB without affecting the external definition. Let's see how Block works first: f[x_] := x Block[{f}, Print@DownValues[f]; f[x_, y_] := x y; ...


28

The first element in the triples seems to indicate the type of curve used for the segment where 0 indicates a Line, 1 a BezierCurve, and 3 a BSplineCurve. I haven't figured out yet what 2 does. Edit: When the first element of the triple is 2, the segment will be a BezierCurve similar to option 1 except that with option 2, an extra control point is added to ...


25

I am somewhat reluctant to offer this as an answer since it is inherently difficult to comprehensively address questions on undocumented functionality. Nonetheless, the following observations do constitute partial answers to points raised in the question and are likely to be of value to anyone trying to write practical compiled code using Bags. However, ...


23

Other answers have already suggested ways of querying options. There's no way of systematically generating a list of all string values, but it's not too difficult to put together a list of all of the values which are used by Wolfram Research in Mathematica itself. If you look in the various files in these locations: ...


23

One of the excellent places to look is the Wolfram Demonstration Project. There are many cases with custom controls there. You can test out controls immediately and download the source code. Because I know that site pretty well I will keep the list here. Relief-Shaded Elevation Map 3D Waves Potter's Wheel Motion Blur Contours of Algebraic ...


20

There is a public, but undocumented, function called GeometricFunctions`DecodeFilledCurve which helps to decode this type of undocumented FilledCurve: GeometricFunctions`DecodeFilledCurve[ FilledCurve[{{{0, 2, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}, {0, 1, 0}}}, {{{12.887695983062486, 5.160000000000004}, {1.8237311169604027, 5.160000000000004}, ...


16

Problems with undocumented functions I think that this is one of the things that everyone has to decide on their own. The biggest problem for using undocumented functions is that nobody is responsible for maintaining them, and therefore, it becomes explicitly your responsibility to maintain their use in the piece of software you are building with it. And ...


15

The two main arguments against using undocumented functions are: Your code might not work as expected in future versions; Your code might not work as you intended in the current version, because you only have a partial understanding of a function or option that is undocumented. In the case of Mathematica, though, there is no guarantee that even ...


15

I haven't looked deeper into this but have you tried all the events which you can find in the documentation of GUIKit? Especially here: GUIKit/ref/GUIInformation The list at the bottom contains at least all events you have mentioned: {"Action", "ActionPerformed", "Ancestor", "AncestorAdded", "AncestorMoved", "AncestorRemoved", "AncestorResized", ...


15

Some you can find in the Documentation Center, like the angular slider in Dynamic's documentation (under Applications), or the ValueThumbSlider in the Advanced Manipulate Functionality section (under Custom Control Appearances). Some you can find in developer packages like the angular slider in the "Experimental`" package: Needs@"Experimental`"; ...


15

This is not related to evaluation. Internal`Bag, like many other special types, is an atomic object. You can verify this using AtomQ[x]. This is despite its InputForm suggesting a structure. This is no different from how Graph, Rational, Complex or SparseArray behave. (Though for SparseArray, most list manipulation functions are implemented, so it's ...


15

It should be a comparison function. One can simulate the standard behavior by Signature[{1, 2, 3}, If[#1 < #2, True, 0] &] Signature[{2, 1, 3}, If[#1 < #2, True, 0] &] Signature[{1, 1, 3}, If[#1 < #2, True, 0] &] (* 1 *) (* -1 *) (* 0 *) If the first argument is less than the second we return True (or False, it doesn't matter!), ...


14

nb2 = NotebookOpen[$InstallationDirectory <> $PathnameSeparator <> "SystemFiles" <> $PathnameSeparator <> "FrontEnd" <> $PathnameSeparator <> "StyleSheets" <> $PathnameSeparator <> "Core.nb"]; Note that some of the named styles in the core stylesheet styles are empty, i.e. the style name is ...


14

Using FullForm, you can see that ImageSize -> 1 -> 1 is the same as ImageSize -> (1 -> 1) i.e., the option value itself is a rule. This appears to be an undocumented shorthand for scaling a graphics to the correct image size or to scale up/down by a factor. Observe the following, using a modified version of the example: img = ...


13

There is an undocumented "Hand" named cursor that should work on all platforms. MouseAppearance[Plot[Sin[x], {x, 0, 6}], "Hand"] Unfortunately, there isn't anything that resembles a grabbed hand. Here are some other undocumented ones. Nothing here is secret, but most of it is comparatively boring and, being undocumented, is potentially subject to change ...


13

This is quite a find. I've only had time to play with it a little, but are some interesting results: Region`ConvexRegionQ[Disk[{1., 0.}]] True Region`RegionCentroid[Disk[{1., 0.}]] {1., 0.} Region`RegionMeasure[Disk[{1., 0.}]] π Region`RegionIntersection[Disk[{0, 0}], Disk[{1, 0}]] seems to do nothing, but Region`RegionMeasure @ ...


12

About your question regarding the definition of the type of local variables in Compile, Compile has an optional third argument that allows you do this in the same manner you specify arguments. It helps the compiler solve some type ambiguity issues sometimes as by default a local variable is considered a Real number. This can be the case if a local variable ...


11

Perhaps: using systemnames = Names["System`*"]; Select[systemnames, CurrentValue[#] =!= $Failed &]; CurrentValue /@ % // Short (* ==> {False, {FrontEnd`FileName[{$UserBaseDirectory, "Autoload"}], ... } *) for the System` context, and replacing System with the appropriate context name for other members of the list Contexts[]?


11

I'm sure there must be a better way, but this works: h = System`Utilities`HashTable[]; System`Utilities`HashTableAdd[h, "a", 1]; System`Utilities`HashTableAdd[h, "b", 2]; ToExpression[ToString[h, InputForm], InputForm, Hold][[1, 2]] {{"a", 1}, {"b", 2}} Mr. Wizard provides a more terse version: ToHeldExpression[ToString[h, InputForm]][[1, 2]]


11

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


10

I hope it's not bad form to revive such an old thread, but FilledCurves can have more than one component. To handle things like glyphs for "o" and "i" that have multiple boundaries, you need to map @Heike's solution onto the components: conversion[curve_] := Module[{ff}, ff[i_, pts_, deg_] := Switch[i, 0, Line[Rest[pts]], 1, ...


10

Pretty cool; EquationalLogic`FindCounterexample is still mysterious (at least to me), but I managed to get it to do something more interesting than spit back numbers. EquationalLogic`FindCounterexample[f[a, i] == a, f[a, a] == a] (* {{f -> ({{1, 2}, {1, 1}}[[##1]] &), a -> 1}, {i -> 2}} *) It appears the the first clause satisfies the ...


10

If you notice Mathematica Documentation Center search field is kind of the same thing. And search window from Ctrl-F too. It uses a similar concept to what I'll show. Important thing to know is that EventHandler can track commands from the Mathematica menu. There is an undocumented option HandleShiftReturn and here is a trick I learned from FW: ...


10

For a more clear view, here is a table of some of the Region functions. AppendTo[$ContextPath, "Region`"] Clear[testfunc] testfunc[reg_] := {ToString /@ #, Through[#[reg]]} &[{ ConvexRegionQ, BoundedRegionQ, RegionDimension, Module[{dim = RegionEmbeddingDimension[#]}, ...


9

You can also look at the GUIKit` package which allows you to create complicated widgets and panels that mimic the look and feel of the OS. The user guide/tutorial is pretty decent and has several examples too that you can learn from and modify to your needs. In fact, a lot of the additional editing/explorer functionality like GraphEdit and DatabaseExplorer ...


8

ExpressionCell[Panel@DynamicModule[{input = ""}, InputField[Dynamic[input], String]]] Content added: ShiftReturn pressed: Learned this here.


8

While the existing answers answer your question of whether/when it is a bad idea to use undocumented functionality, you didn't yet get an answer about your question why that functionality is undocumented. Of course, the ultimate answer to this question could only come from Wolfram (because they were making that decision), however here are several common ...


8

As a starting point I'll write up what I found about these functions before. I'm hoping someone will take a better look at them and will write a more complete answer. Spelunking in version 8, Internal`AddPeriodical[Print["boo!"], 3] Now you get a boo! every 3 seconds. Internal`Periodicals[] (* ==> {Print["boo!"]} *) Now do ...


8

My colleague John Fultz suggested the following answer. f /: MakeBoxes[dat : f[args_], fmt_] := TagBox[ToBoxes[Rasterize@RandomImage[1, {100, 100}]], InterpretTemplate[f[args] &], Editable -> False, Selectable -> True, SelectWithContents -> True, Tooltip -> "tooltip"] After a bit of exploring I realized that I should have checked ...



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