# Tag Info

24

Mathematica does it internally by using BoxFormArrangeSummaryBox, which is quite straightforward to figure out: MakeBoxes[obj_MyObject, fmt_] ^:= Module[{o = List @@ obj, shown, hidden, icon = Graphics[{Blue, Circle[]}, ImageSize -> 70]}, shown = {{ BoxFormMakeSummaryItem[{"Name: ", "Name" /. o /. "Name" -> Missing[]}, fmt], ...

23

From the documentation: PlusMinus[a] displays as $\pm x$. I believe it is purely a formatting function. It is not literally interpreted as $\pm x$. However, per the documentation, you can assign values to it. You can assign a rule that mimics the behavior you want by assigning an UpValue to PlusMinus: PlusMinus /: PlusMinus[a_]^2 := a^2 Then: ...

15

The old typesetting can be restored by SetSystemOptions["TypesetOptions" -> "IconicElidedForms" -> False]; Also mentioned previously: (1), (2), (3).

11

Mathematica 10 introduces IntegerName: IntegerName[n] gives a string containing the full English name of the integer n. IntegerName[n,"type"] gives a string of the specified type. Possible types include: "DigitsWords" a combination of three-digit numbers and words "Words" using only words "Approximate" the first few digits ...

11

From very old documentation (I think Mathematica 4): Parentheses within a single RowBox by default grow to span whatever other objects appear in the RowBox. Some expandable characters, however, grow by default only to a limited extent. The latter seems to apply to square brackets. But we can overcome that by using a StyleBox: StyleBox [RowBox[{"[", ...

10

SeedRandom[10]; col1 = RandomInteger[{1, 20}, 10]; col2 = RandomInteger[{1, 20}, 10]; txt = { n = Length[col1]; Text[ToString[#], {1, n--}, {1.5, 0}] & /@ col1, n = Length[col2]; Text[ToString[#], {2, n--}, {-1.5, 0}] & /@ col2}; lines = Cases[ Outer[ If[#1[[1]] == #2[[1]], Line[{#1[[2]], #2[[2]]}], Sequence[]] ...

10

Here's a way that seems to work: CenterDot @@ Flatten[ConstantArray @@@ FactorInteger[20!]] CenterDot @@ Flatten[ConstantArray @@@ FactorInteger[625]] To get the number back, merely do Times @@ expr where expr is the name for the expression that results from the code above.

10

You can also make use of Inactive to allow you to calculate the value later. Starting with march's solution and altering the Apply. n = 20!; t = Inactive[Times] @@ Flatten[ConstantArray @@@ FactorInteger[n]] (* 2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*3*3*3*3*3*3*3*3*5*5*5*5*7*7*11*13*17*19 *) t can be Activated to calculate the value. Activate@t == n (* ...

9

The reason is that you have empty history because you set $HistoryLength = 0 (as you confirm in the comments). I recommend setting$HistoryLength to be at least 3 in order to get the [Show Full Output] button working in the most practical cases.

9

Add this to your notebook or init file $PrePrint = If[MatrixQ[#], MatrixForm[#], #] &; Then all matrices will automatically display as MatrixForm and If you want to format lists as column vectors also, try$PrePrint = Which[MatrixQ[#], MatrixForm[#], VectorQ[#], ColumnForm[#], True, #] &; Now also

9

Since python has pretty close syntax as Fortran, converting the expression to FortranForm is what I usually do in this case. testing2 = ExpandAll[ D[(x - A)^2 + (y - B)^2 + (v - C)^2 + (x + y - (S + v) - D)^2 - \[Lambda]1*x - \[Lambda]2*y - \[Lambda]3* v - \[Lambda]4*(x + y - (S + v)), {{x, y, v}}]] sols = {x, y, v, x, y, v, \[Lambda]1, ...

9

You can create your own ...Form wrapper that will format Times as you want it. Let's start with ordering function that can be used in SortBy. It puts numeric coefficients in front, expressions present in par are ordered according to their position in par, all other expressions are moved to the end. ClearAll[par, order] par = {(1 - p), p, k, Subscript[k, ...

9

percent = {21.15, 42.3, 57.68, 73.06, 84.6, 90.37, 96.14, 99.99, 99.99, 99.99, 99.99}; {{"A", "B", "C"}, GatherBy[percent, {# <= 85, # <= 95, # <= 100} &]} // TableForm This can also be written as {{"A", "B", "C"}, GatherBy[percent, Thread[# <= {85, 95, 100}] &]} // TableForm

9

There are two alternatives I would suggest, depending on what your plans for the Background are. Here is an illustration: Text[Pane[Style["(1, 0, 0)", 12, Background -> Yellow], ImageMargins -> 10], {1, 1, 0}] Text[Framed[Style["(1, 0, 0)", 12], Background -> Yellow, FrameMargins -> 10, FrameStyle -> None], {1, 1, 0}] The first ...

9

Thanks for Michael E2 and J.M.'s hint. I took some time to understand the SphericalLinearInterpolation[] that written by J.M., then I discovered that InterpretationBox[] is the built-in that implements the function object like InterpolationFunction[], etc. MY TRIAL AUXILIARY FUNCTIONS searchSpan[knots_, u0_] := With[{max = Max[knots]}, If[u0 == max, ...

9

One possibility is to temporarily inactivate the arithmetic operators, like so: Block[{Times = Inactive[Times], Plus = Inactive[Plus]}, Det[{{a, b}, {-a, -b}}]] a*(-1*b)+-1*b*(-1*a)

9

With Frame -> All, the automatic Spacings are weird. The automatic BaselinePosition is bad either way. It seems to be a good idea to include substitutes for as many of those options which are Automatic by default as possible: pic2 = ImageResize[ImageCrop@Rasterize@Graphics@Disk[], {Automatic, 40}]; Grid[{{pic2}}, Alignment -> {Center, Center}, ...

8

The dimming is controlled by the option PrivateCellOptions->{"EvaluationUnmatchedStyle"}. It must be applied at the cell level, but this is easy to do in your example by using CellPrint with the "Print" style to match what Print does. CellPrint@ ExpressionCell[g, "Print", PrivateCellOptions -> {"EvaluationUnmatchedStyle" -> {}}]

8

PlusMinus[{x_, err_}] := Module[{errE = Last@MantissaExponent[err], xE = Last@MantissaExponent[x]}, Row[{"(", NumberForm[N@Round[x, 10^(errE - 1)]*10^(-xE + 1), {xE - errE + 1, xE - errE}], " \[PlusMinus] ", NumberForm[N@Round[err, 10^(errE - 1)]*10^(-xE + 1), {1, xE - errE}, ExponentFunction -> (Null &)], ")", " ...

8

Depending on how you want the table aligned, you could use percent = {21.15, 42.3, 57.68, 73.06, 84.6, 90.37, 96.14, 99.99, 99.99, 99.99, 99.99}; TableForm[BinLists[percent, {{0., 85., 95., 100.}}], TableHeadings -> {{"A", "B", "C"}}] or TableForm[{{"A", "B", "C"}, BinLists[percent, {{0., 85., 95., 100.}}]}, TableAlignments -> {Center, ...

8

This might work for you. The idea is to create a PatternTest function which only returns True outside of box structures. mysplit[s_String, c_String] := Module[{f, i = 0}, f["$$"] := i++; f["$$"] := i--; f[c] := i == 0; StringSplit[s, _?f]]

7

Perhaps there is a more convenient way of doing this than resorting to esoteric boxes. The following uses the code you posted to define a function: summaryDisplay = DynamicModule[{open = True, sqrplus = RawBoxes@FrontEndResource["FEBitmaps", "SquarePlusIconMedium"], sqrminus = RawBoxes@FrontEndResource["FEBitmaps", "SquareMinusIconMedium"], ...

7

You're going to have to write a separate function that uses Integrate instead of NIntegrate if you want something that looks like a matrix of traditional integrals, which is what I think you want. You also need to use HoldForm to keep the integral from evaluating. You also need someway to set the values that you want in the held version of the expression. ...

7

What I think is happening is that the SetOptions statement in init.m is executed during kernel initialization as expected, however when the notebook window is opened, the front-end sets PageWidth to be WindowWidth. Furthermore, the kernel value does get changed accordingly whenever the window is resized. This being the front-end, I would not be surprised if ...

7

I believe this is what $PrePrint is for, since you only want to affect how the expression looks, and I'm guessing you want it to happen automatically for every input. Using$PrePrint thus allows you to use Out[n] without worrying about the held expressions. This seems to work (but I would like to find a better way to take care of the signs between terms in ...

7

From the docs: CenterDot @@ Superscript @@@ FactorInteger[7!] Though CenterDot does not work well for prime powers: CenterDot @@ Superscript @@@ FactorInteger[5] If this is a problem, you could just define your own: myCenterDot[e_] := e myCenterDot[args__] := CenterDot[args] Now it works fine: myCenterDot @@ Superscript @@@ FactorInteger[5] ...

6

You people with your fancy version 10 have it too easy. StringJoin@Reverse@MapIndexed[ToString[#] <> {"", " thousand ", " million ", " billion ", " trillion" }[[First@#2]] &, Reverse@(FromDigits /@ Partition[PadLeft[#, 3 - Mod[#, 3, 1] + # &@Length@#] , 3])] &@ IntegerDigits[123456789] "123 million 456 ...

6

data = Table[(i + j) i (i - j), {i, 1, 2}, {j, 1, 22}]; The first step is to define a function to break up each row in the data into lines not exceeded the specified maximum line length. prep[row_, fieldWidth_, lineLength_] := Module[{items = Floor[lineLength/fieldWidth]}, Partition[row, items, items, 1, {}]] The second step is to do the ...

6

V = (-G*Mn)/Sqrt[x^2 + y^2 + z^2 + cn^2]; Vx = D[V, x] /. {x -> x[1], y -> x[2], z -> x[3]}; StringReplace[ToString[Vx, FortranForm], " " -> ""]

6

Here is my take on this problem. errorForm[num_, err_, digits_] := Module[{exp, n, e}, exp = Floor @ Log10 @ num; n = NumberForm[num/10^exp, digits, ExponentFunction -> (Null &)]; e = NumberForm[err/10^exp, digits, ExponentFunction -> (Null &)]; Row[{ "(", n, "\[ThinSpace]\[PlusMinus]\[ThinSpace]", e, ") ...

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