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

15

This has nothing to do with N. You are observing the fact that by default Mathematica truncates machine precision numbers to 6 digits for displaying them. Enter 1.000001 without N and evaluate it: you'll see the same output (i.e. "1."). You can adjust this in Preferences, Appearance, Numbers, Formatting. The numbers are still stored to full precision, ...

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 \text{...

13

Citing this 1996 year MathGroup post by Dave Wagner, A similar function, Continuation[n], is called to format the character at the beginning of continued lines. So, for example, the definition Format[Continuation[n_]] := StringForm["()",n] would place a line number inside of parentheses on the second and subsequent lines of a multi-line ...

11

Hint: try In[1]:= FullForm[N[1.000001, 10]] which returns Out[1]//FullForm= 1.000001 That tells you the 'rounding' is happening on the front end only, but that the full precision you asked for is still there. Roughly speaking, objects have an internal representation, and the front end 'interprets' this representation to produce the display in a ...

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

10

MeshShading Plot[Sin[x], {x, 0, 2 Pi}, MeshFunctions -> {# &}, Mesh -> {{Pi/2}}, MeshShading -> {Red, Directive[Dashed, Blue]}, PlotStyle -> Thick] Two piecewise functions Plot[{ConditionalExpression[Sin[x], x <= Pi], ConditionalExpression[Sin[x], x >= Pi]}, {x, 0, 2 Pi}, PlotStyle -> {Directive[Thick, Red], Directive[...

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[ {grid[{{"Something:...

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

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

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

This goes and modifies the displayed box form. Please note that this is not meant to be used as input to other computations, just for display - so it's similar to MatrixForm in that sense. ClearAll[ShortIntegerForm]; ShortIntegerForm[expr_] := ToBoxes@expr /. n_String /; StringMatchQ[n, Repeated[DigitCharacter, {4, \[Infinity]}]] :> ...

9

Question 1: What is the typesetting in Mathematica? What procedures does it include? I think that this 2008 year MathGroup post by John Fultz completely answers this question, so I'll cite it here: In version 6, the kernel has absolutely no involvement whatsoever in generating the rendered image. The steps taken in displaying a graphic in ...

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

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 &)], ")", " \[Times]...

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

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: InactiveDumpassembleInactiveSumProduct[{args_, disp_, interp_, char_, tag_, tooltip_, fmt_}] := TemplateBox[args, tag, DisplayFunction -> Function[disp], InterpretationFunction -> Function[interp], ...

8

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

8

I think it may perhaps be easier just to combine plots and modify (e.g. suppress unnecessary frame ticks). I post this as a motivating answer rather than definitive answer. li is a modified version of OP function: li[p_, q_, phi_, {l_, u_}] := DensityPlot[(If[p > 0, Sin[2 Pi p^2 x]/(2 Pi p^2 x), 1] Cos[ 2 Pi p^2 q x + phi/2])^2, {x, -30, 30}, {y, ...

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

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