Hot answers tagged

24

If this is something you want in general, try: SetOptions[$FrontEnd, PrintPrecision-> 10] and if you just want it for a specific notebook, then do: SetOptions[InputNotebook[], PrintPrecision-> 10]


20

PrintPrecision You can control the number of digits displayed using the PrintPrecision option. You have a number of options for its use. You can set it Globally or for the specific Notebook using the Options Inspector. You can also use it directly with Style: Style[123.189094, PrintPrecision -> 10] 123.189094 You can set it temporarily for one ...


18

This option is not relevant since version 6 of Mathematica. Before version 6, graphics did not display immediately after evauating the (inert) Graphics[] expression. They could be shown using the Show command (it was a side-effect of Show). (This is the reason why the function which today is used to combine graphics has such an unusual name---Show.) So ...


15

Maybe this : NumberForm[#, 10] &@ {123.189094`, 123.189263`} {123.189094, 123.189263 } ? Edit Consider also this utility of NumberForm[ x, {m, k}] giving m real digits of x with k digits to the right of the decimal point, e.g. NumberForm[#, {10, 7}] &@ { 197.9898987322333, 201.73205080756887 } { 197.9898987, 201.7320508 }


15

Here are three progressively more intrusive steps to troubleshoot Mathematica. Hold down Shift-Control (Shift-Command on Mac) while starting Mathematica, as described here. If this didn't fix the problem, move to the next step. Evaluate SystemOpen[$UserBaseDirectory]. This will reveal the directory where Mathematica keeps all its settings, packages, ...


14

==== EDIT: Applications/Usability - after @Jens comment ==== @Jens is right in his comment that this could be useful - thanks for bringing it up. You can define a function just once and then automate its application via global SetOptions[Plot, DisplayFunction-> myFunctiom] Now let see how it works. =====================================================...


14

Typesetting in Text cells Cell[TextData[Cell[BoxData[ FormBox[ RowBox[{ FractionBox["1", "N"], RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"i", "=", "1"}], "N"], FractionBox[ RowBox[{ SubsuperscriptBox[ OverscriptBox["x","~"], "j", "i"], "(", RowBox[{"k", "|", "k"}], ")"}], SqrtBox[ ...


14

Mathematica 10 is not high-DPI-aware on Windows and so Windows renders it at the native resolution and then scales it by a factor of 2 by default to make it readable. Once Mathematica supports high-DPI displays in Windows, they will be able to properly render text and graphics that aren't blurry. If you're running Windows 8.1, you can disable this default ...


14

You can use this to create a functionality which will fit your need the best. Here's how you can preview your input cell with c highlighted Red. CellPrint[ NotebookRead @ PreviousCell[] /. "c" -> InterpretationBox[ StyleBox["c", FontColor -> RGBColor[1, 0, 0]], c ] ] You can even evaluate such cell. General ...


12

Two possible answers. TexForm converts a Mathematica expression into something you can use to paste it in TeX: TeXForm[x/Sqrt[5]] ==> \frac{x}{\sqrt{5}} A usually more convenient way of achieving this is right-clicking output, and selecting Copy as | LaTeX. If all you're looking for is a neater display form inside Mathematica, then have a look at ...


11

I consider this a bug in the front end. Very odd it is, that not all forms eat up the first result. Consider this simple example m = {1}; MatrixForm@m MatrixForm@m which gives 2 outputs as expected. If we look on the traffic between kernel and front end, then we see, that the kernel indeed sends 2 outputs back. No matter which kind of form we use: FE <...


11

Actually, I know just one special case where DisplayFunction -> Identity is in fact still needed even with version 8: As I mention in this answer, assume you have started JavaGraphics in a Kernel-only session to make plots. Now you decide you're done displaying plots and instead want to create only non-displayed plots for export. Then you have to do ...


11

Graphics rendering was fundamentally changed in Mathematica version 6. Before that graphics output was treated specially, like a Print statement. Now output graphics are treated much the same as any other expression, and output can be suppressed with ; (CompoundExpression). The documentation states: Between Versions 5 and 6 The graphics ...


11

The Program style is purpose-built for this sort of thing: If you do not like the look of the bars above and below the cell, you can remove them by selecting the cell and changing the CellFrame option in the Option Inspector:


11

The reason for the difference between ugly and nice is in the (hidden) data type that Dataset assigns them: ugly = Dataset[{<|"a" -> 11, "b" -> 2, "c" -> 12|>}]; nice = Dataset[{<|"a" -> 11, "b" -> "2", "c" -> 12|>}]; << Dataset`; << TypeSystem`; In[43]:= ugly // GetType (* Vector[Assoc[Atom[Enumeration["a", "b", "...


9

Use NumberForm: NumberForm[{123.189094, 123.189263}, 9]


9

You can use something like this dx /: MakeBoxes[dx[a_], fmt_] := RowBox[{FractionBox["\[PartialD]", "\[PartialD]x"], MakeBoxes[a, fmt], "=", MakeBoxes[#, fmt] &@D[a, x]}]; dx[Sin[x]] dx[Sin[x]] // TraditionalForm I prefer MakeBoxes but it also can be implemented with Format ClearAll[dx] Format[dx[a_]] := DisplayForm@RowBox[{...


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)


8

If you just want the output, well, write it manually. EscpwEsc gives you the piecewise bracket. Then you can insert a table (Insert->Table/Matrix) or learn the shortcuts with Ctrl, and CtrlReturn, etc. I got this box structure. You can see the result by running. RawBoxes@FormBox[ RowBox[{"\[Piecewise]", GridBox[{{RowBox[{"0", ","}], ...


8

The problem is that you gave "\[Equal]" as the centering character, but you should have given "\[LongEqual]". Column[TraditionalForm /@ {HoldForm[y] == x, HoldForm[R^2] == 0.998}, Alignment -> "\[LongEqual]"] To see that TraditionalForm replaces == with "[LongEqual]", you can open up the output cell your code produces by clicking on Show ...


8

There are three kinds of units for measuring on-screen length, i.e. pixels, points and physical units (like inches/centimeters/etc.). For me the confusing part is pixels vs. the so-called "points". Before investigating OP's question, I didn't know that "point" is the size of an ink-point on printer. I have a screen with the PPI (pixels per inch) as $96\;(\...


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


7

The other answers are fine, but if all the interest is in the small-end digits, consider something like: ((RealDigits /@ {123.189094`, 123.189263`}) /. {a__, 0..} -> {a})[[All, 1, -4 ;; -1]] {{9, 0, 9, 4}, {9, 2, 6, 3}} This picks up the smallest-end non-zero digits so you can focus on them. This won't work if your numbers have a different ...


7

To expand my comment into an answer: HoldForm[X[x, y, z]] == X[x, y, z] // TraditionalForm $$X(x,y,z)=\left( \left\{ \begin{array}{cc} \frac{3}{4 \pi } & \sqrt{x^2+y^2+z^2}\leq 1 \\ 0 & \text{True} \\ \end{array} \right. \right)$$ But Mathematica decides it needs parentheses. I agree that this doesn't look ideal. There are a couple of ways ...


7

Would a CellFrame around a TextCell work? Framed[ x -> TextCell[ Column[{"Depression", "PTSD", "Diabetes Type II", "Smoker"}], "Text", CellFrame -> {{True, False}, {False, False}}]]


7

An alternative way of getting a similar display would be to define a new function leftFramed that only puts a vertical extensible line to the left of the content: leftFrame /: MakeBoxes[leftFrame[obj_], _] := RowBox[{"\[LeftBracketingBar]", ToBoxes[obj]}] Framed[x -> leftFrame[ Column[{"Depression", "PTSD", "Diabetes Type II", "Smoker"}]]] ...


6

InputForm gives {123.189094, 123.189263} // InputForm (*==> {123.189094, 123.189263} *)


6

I see three ways: Copy and paste everything into a new notebook (to ensure we don't destroy the output for good). Then select Cell -> Delete All Output from the menu. alt-click (⌥-click on a Mac) on an input cell's bracket. All input cells will get selected. Now copy them and paste them into a new notebook. alt-click (⌥-click on a Mac) on an input cell'...


6

one idea.. Needs["ErrorBarPlots`"] Show[{ErrorListPlot[ Table[ {{x, Sin[x]}, ErrorBar[RandomVariate[NormalDistribution[.3, .1]], RandomVariate[NormalDistribution[.1, .1]]]} , {x, 0, 2 Pi, .2}], ErrorBarFunction -> Function[{coords, errs}, {Opacity[0.2], Rectangle[coords + {errs[[1, 1]], errs[[2, 1]]}, coords + {...


5

On a Windows machine you can set the display resolution in terms of DPI yourself (in the Display control panel). Whereas 96 DPi is a common setting for normal density screens, 120 DPI is useful and common for high density screens. This has effect on font size and appearance and also on thing like icons. 96 x 1.25 = 120. Other options can be found in the ...



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