Tag Info

New answers tagged

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


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


2

You could let FindDivisions do the work: scale = (9.11/10^31) FrameTicks -> {{1, 2, 3}, ( # { scale , 1}) & /@ FindDivisions[{-2*10^-28 /scale, -2*10^-32 /scale}, 8], None, None} FrameTicks -> {{1, 2, 3}, {{-2.2775*10^-28, -250}, {-1.822*10^-28, -200}, {-1.3665*10^-28, -150}, {-9.11*10^-29, -100}, {-4.555*10^-29, -50}, {0., ...


4

Here is a function that does what you want, I think: trimPoint[n_, digits_] := (*display number n with given number of sig.digits, trim trailing decimal point*) NumberForm[n, digits, NumberFormat -> (DisplayForm@ RowBox[Join[{StringTrim[#1, RegularExpression["\\.$"]]}, If[#3 != "", {"\[Times]", SuperscriptBox[#2, #3]}, {}]]] &)] ...


2

When you evaluate a ContourPlot3D expression, it will become a Graphics3D expression containing a collection of graphics primitives like Point, Line, and (more complicated) GraphicsComplex. In your case the expression looks something like this: Graphics3D[ GraphicsComplex[ ... ], <options> ] And your color Orange is in the GraphicsComplex, in ...


2

I shall adapt my code from How do I reassign canonical ordering of symbols? with the addition of a rule for the Power[_, -1] form. I assume that any Variables not in par are to be placed at the end. reorderIstván[expr_, par_List] := Module[{h, rls}, rls = MapIndexed[x : # :> h[#2, Replace[x, rls, -1]] &, DeleteDuplicates @ Join[par, ...


1

It seems that a clean yet undocumented method has existed since v5.2 or earlier that could be applied here. Please reference Undocumented fourth parameter of Collect; how long has it been there? and then observe: Collect[(1 + x + Cos[s] x^2)^3, x, # &, Defer[+##] &] 1 + 3 x + x^2 (3 + 3 Cos[s]) + x^3 (1 + 6 Cos[s]) + x^4 (3 Cos[s] + 3 Cos[s]^2) ...


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


1

TableForm[Table[{i, j}, {i, 4}, {j, 8}], TableDirections -> {Column, Column, Row}] or Flatten[Table[{i, j}, {i, 4}, {j, 8}], 1] // TableForm Exporting: Export["filename.csv", Flatten[Table[{i, j}, {i, 4}, {j, 8}], 1]]


1

Perhaps something as simple as Join[{something}, #] & /@ Table[{i, j}, {i, 4}, {j, 8}] {{something, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {1, 8}}, {something, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {2, 5}, {2, 6}, {2, 7}, {2, 8}}, {something, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}, {3, 7}, {3, 8}}, {something, {4, 1}, {4, ...


1

What about this: Table[{" ", Table[{i, j}, {j, 1, 8, 1}]}, {i, 1, 4, 1}] which has no "something", and you might also put it in the TableFormif needed. Alternatively you might make a Gridout of it: Grid[Table[{" ", Table[{i, j}, {j, 1, 8, 1}]}, {i, 1, 4, 1}], Dividers -> All] yielding the following: As to your second question, what ...


2

You can use Inactivate with TraditionalForm. Inactivate[h = (R.omega + x).x] // TraditionalForm Inactivate prevents the operations from executing and TraditionalForm gives the formatted output. Hope this helps.


0

Thank you for your replies, they will be useful in the future. I found the solution to my specific problem however. One can use: Distribute[(HoldForm[R].HoldForm[omega]+HoldForm[x]).HoldForm[x]] Albeit cumbersome, it does the trick. To avoid it one can use @march or @MariusLadegårdMeyer solutions! Thank you.


5

There will be more clever answers from people who better understand Mathematica's order of evaluation and how to use Hold and such, and so I can't answer your question in exactly the way that you've phrased it, but here's how I go about doing these types of things. First, instead of declaring the values of x, omega, and R as you've done, make a list of ...


5

The documentation could have been clearer about this, but at least it says prints with all real numbers … in engineering notation. Therefore, it is not a bug. Use N to convert to floating point before using EngineeringForm. Exact numbers such as Pi, Sqrt[2], 7/5 or even 1*^10 won't be automatically converted to inexact forms by most *Form functions. ...


6

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


3

The -noprompt switch does several things: it suppresses the Mathematica ... banner and all the In/Out prompts, sets the page width to Infinity and, most relevantly, switches the kernel default print form to InputForm (being preferable, in batch mode, to the regular two-dimensional typesetting used for interactive terminal sessions). Example : What I have ...


5

Collecting together the advice given in comments to the question by kirma and Guesswhoitis, the answer is expr = {0, 1/4 (Cos[(3 t)/4] - Cos[(5 t)/4] + I (-Sin[(3 t)/4] - Sin[(5 t)/4])), 1/4 (Cos[(3 t)/4] - Cos[(5 t)/4] + I (-Sin[(3 t)/4] - Sin[(5 t)/4])), 0, 1/4 (Cos[(3 t)/4] - Cos[(5 t)/4] + I (-Sin[(3 t)/4] - Sin[(5 t)/4])), 0, 0, 0, 1/4 ...


1

Here's another idea that makes use of ArrayFlatten GridPlus[data_, headers_, opts : OptionsPattern[Grid]] := Grid[ArrayFlatten[{{{{""}}, {headers[[1]]}}, \ {Transpose[{headers[[2]]}], data}}], opts]


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


1

\[GothicCapitalR] = {{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, {{0, 1, 0}, {0, 0, 1}, {1, 0, 0}}, {{0, 0, 1}, {1, 0, 0}, {0, 1, 0}}, {{1, 0, 0}, {0, 0, 1}, {0, 1, 0}}, {{0, 0, 1}, {0, 1, 0}, {1, 0, 0}}, {{0, 1, 0}, {1, 0, 0}, {0, 0, 1}}}; i = 1; j = 1; det = 1; a = Subsets[Range[6], {3}]; v = {x, y, z}; k = \[GothicCapitalR].v; PolynomialLCM @@ ...


4

Instead of While[i<21,...], use Table[...,{i,20}]. The ... part can be reduced to r = k[[a[[i]]]]; Factor[Det[r]] To find the PolynomialLCM, simply replace the head ( List) of the table with PolynomialLCM using Apply, or @@ for short: PolynomialLCM @@ Table[...,{i,20}]


2

Replace the Print[det] in the print with: Paste[det]



Top 50 recent answers are included