# Tag Info

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

17

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

13

TeXForm@ToRadicals@Root[-4 q2^2 - 4 q2^3 + (7 q2 + 19 q2^2) #1 - 17 q2 #1^2 + 2 ^3 &, 1] \frac{1}{6} \sqrt[3]{2222 \text{q2}^3-855 \text{q2}^2+3 \sqrt{3} \sqrt{-15633 \text{q2}^6+2190 \text{q2}^5-7225 \text{q2}^4+2744 \text{q2}^3}}-\frac{42 \text{q2}-175 \text{q2}^2}{6 \sqrt[3]{2222 \text{q2}^3-855 \text{q2}^2+3 \sqrt{3} \sqrt{-15633 ...

12

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

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

10

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

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

10

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

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

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

The following shows a way to emulate the summary boxes using only documented constructs: grid[g_] := Column[Row /@ MapAt[Style[#, Gray] &, g, Table[{i, 1}, {i, Length[g]}]]] MakeBoxes[c : foo[___], form : (StandardForm | TraditionalForm)] := With[{boxes = RowBox[{"foo", "[", ToBoxes[Panel[ OpenerView[ ...

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

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

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

Mathematica has an inbuilt function CForm which does a pretty good job. However, there are some caveats: No support for Greek/special characters. Your variable names might have Greek characters, which are not supported in C/C++. Hence, you should replace all such variables. Create a list, maybe call it subsGtoCpp, put all rules which are required in list ...

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

8

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

8

As mentioned in previous answers, there is an undocumented(!) setting for this: SetSystemOptions["SimplificationOptions" -> "AutosimplifyTwoArgumentLog" -> False]; Log2[] should stop expanding out after this.

8

You are fortunate here that the polynomial you were considering is a cubic, and thus you have recourse to an alternative radical representation via ToRadicals[]. But recall why Root[] is needed in the first place: there are algebraic numbers (roots of polynomials of degree 5 or higher) that do not admit radical representations. What to do in those cases? ...

8

Histogram does not support a grouped ChartLayout. Hence the workaround using BarChart: I've arranged the 'histogram' into a bar chart so that the data can be displayed side by side. An alternative to using BarChart with "Grouped" layout is to use a custom ChartElementFunction to produce the desired Histogram layout: ClearAll[groupedHistogram] ...

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

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

Another way is to use Grid for complex layouts. One drawback is that Delimiter does not work as in the original Manipulate, the advantage is that you can use all styling options available to Grid, plus you don´t have to fiddle with discrete ImageSize values etc.: Manipulate[ ParametricPlot[{y t^3 - u, x t^2 + z}, {t, -10, 10}, PlotRange -> {{-1.5, ...

7

This is a bug I fixed in 10.4.0. Sorry for the inconvenience! To work around it in earlier versions, evaluate the following block of code: InactiveDump`assembleInactiveSumProduct[{args_, disp_, interp_, char_, tag_, tooltip_, fmt_}] := TemplateBox[args, tag, DisplayFunction -> Function[disp], InterpretationFunction -> Function[interp], ...

7

A truly weird question! I cant imagine why you would want to do that but here goes.. f[i_] := FromDigits[IntegerDigits[i][[;; 3]]]; ((323909701210368 Sqrt[3] t^(56/3))/(11 Gamma[2/3] Gamma[ 59/3]) + (23266815064996478976000 t^(71/3))/(Gamma[2/3] Gamma[ 74/3])) /. {Rational[x_Integer /; x > 1000, y_] :> f[x]/y, x_Integer /; x > 1000 ...

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