Tag Info

Hot answers tagged

14

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 }


14

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


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

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


11

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


10

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


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


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


6

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_]] := ...


5

I'm not sure I understood the concerns, so let me know how this works. The N[Pi , 50] isn't recalculated since Dragger doesn't have the attributes HoldFirst or family. Seems it can be dragged anywhere. And I don't know about the rest. Dragger[exp_, size_] := With[{maxsize = First[ImageSize /. Options[Rasterize@exp, ImageSize]] - 0.95 size}, ...


5

Simon's method does seem to work, and I cannot explain why either. However, I recommend a different method. I suggest you convert all the exact numbers to machine precision as this typically evaluates much faster. In fact my fix for your problem with the other question was to add N so that the array could be packed, and the same method works here. Using ...


5

Both colour functions fail for me with Raster. I don't have an answer to why it happens, but I do have a workaround, which is to inject the evaluated colour data into Function using With: GoldColor = With[{x = {{0, Black}, {1/9, RGBColor[32/97, 1/62, 0]}, {2/5, RGBColor[44/59, 23/78, 1/32]}, {3/5, RGBColor[84/85, 1/2, 4/51]}, {2/3, RGBColor[84/85, ...


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


3

There are many ways to do this, depending on how you want to display the coordinates. The following example displays the coordinates in four ways (other than reading them from the graph itself). 1) The first uses a Text graphics primitive in the Epilog option. 2) The second uses the Tooltip applied to a Point graphics primitive also in the Epilog option. ...


3

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


3

For simply transposing a ragged array, see Transpose uneven lists For displaying various transpositions both as upper or lower triangular formats, pad the array before display: Transpose@PadRight[ragged, {Length[ragged], Length@Last[ragged]}, ""] // TableForm


3

I suspect that this has something to do with the code that produces the InputForm cell tags, or rather tagged cells. In addition to the last tagged cell replacing the prior ones you can observe strange behavior when combining CellPrint and InputForm: InputForm[1 // CellPrint] InputForm[2 // CellPrint] InputForm[3 // CellPrint] 1 Out[1]//InputForm= 2 ...


3

You need to use BoxData. Because ToString creates something strange you also obviously have to change "\\" -> "". I don't know if this is a bug or working as designed. equat = (StringReplace[ToString[#1, TraditionalForm], "\\" -> ""] & )[ Expand[ Product[x - RandomInteger[{-10, 10}], {i, 3 + RandomInteger[]}]]]; CellPrint[ ...


3

Try using NotebookEventActions displaying = True; SetOptions[EvaluationNotebook[], NotebookEventActions :> {"UpArrowKeyDown" :> (If[! displaying, Print["up press"]]), "DownArrowKeyDown" :> (If[! displaying, Print["down press"]]), "MouseClicked" :> (If[displaying, displaying = False])}]


3

I recommend that you export your data to a file. But having said that, I think that a normal Print will have the same effect as the hypothetical Short[%,Infinity]. For example (*generate some data*) data = RandomReal[{-1, 1}, 10^4]; (*This will display truncated*) data (*So will this*) Short[data, 100] (*This will display all the data*) Print[data]


3

You could use the \[AligmentMarker] character. To help you better write equations, lets forget about the DisplayFormula style and lets create our own. Set up: Let us create the style DisplayMath. In your notebook where you are writing your displayed equation go to Format > Edit Stylesheet.... Here you will create a new cell. Show the expression of the ...


2

A link was posted in comments that gives the full list of compilable functions in Mathematica 8. If you look at this list, you'll see in particular that there are no *View, no *Dialog and no Input* functions in this list. No user interface element can be compiled to C code or standalone executable in Mathematica. The reason for this is straightforward: all ...


2

Avoiding cleverness as much as possible, you can just use a Do loop: Do[Print[D[Exp[-a*x], {x, n}]], {n, 0, 10}] Or for example Grid@(List@D[Exp[-a*x], {x, #}] & /@ Range[0, 10]) etc


2

Well, as it turns out, the answer to my question was trivial... Instead of using NumberForm on the time list to operate, I just needed to export using another NumberForm version of the time list to operate... like time2... pretty easy... time = Table[i, {i, 0, 0.4, 0.01}]; time2 = Table[NumberForm[i, 6], {i, 0, 0.4, 0.01}]; op = Table[time[[i]]^2 + ...


2

I seem to have found a solution, kind of convoluted, and not entirely sure why it works. Create a cell Cell -> Convert To -> Raw Input Form Open a comment in the cell Paste the ASCII art Close comment This is what it looks like now:


2

Use TraditionalForm for pretty printing: G//TraditionalForm In Details section of documentation on Transpose you can find: and this actually is computable.


1

I have extended your range for illustrative purposes. Two ways: Plot3D[Sin[x/(2*Pi)*1/10]*Cos[y/(2*Pi)*1/10], {x, 1, 100}, {y, 1, 100}] ListSurfacePlot3D[ Partition[ Flatten@Table[{x, y, Sin[x/(2*Pi)*1/10]*Cos[y/(2*Pi)*1/10]}, {x, 1, 100, 1}, {y, 1, 100, 1}], 3], Mesh -> 10, MeshFunctions -> {#1 &, #2 &}, BoxRatios -> {1, 1, ...


1

Something like this? (V9 only, because of Cells.) toggleCellOpen[nb_: SelectedNotebook[]] := (CurrentValue[#, CellOpen] = Not@CurrentValue[#, CellOpen]) & /@ Select[Cells[], CurrentValue[#, Evaluatable] &]


1

I downloaded and examined the CDF you refer to. I conclude from my examination that what looks like a highly stylized TabView may actually be a custom control built based on EvenHandler. Often when one sees what look like fancy versions of Mathematica controls in sophisticated CDFs, they are custom replacements such as the one you were looking at. As far as ...


1

The closest thing to what you're describing are function templates, there is a tutorial on how to use them here. You first have to write the name of the function, for example Plot, and then you hit cmd+shift+k on OS X and ctrl+shift+k on Windows, you'll get this: Once you have typed the mandatory arguments, you can hit cmd+k on OS X or ctrl+k on Windows ...



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