Tag Info

Hot answers tagged

9

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[{"[", ...


7

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


7

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


6

V = (-G*Mn)/Sqrt[x^2 + y^2 + z^2 + cn^2]; Vx = D[V, x] /. {x -> x[1], y -> x[2], z -> x[3]}; StringReplace[ToString[Vx, FortranForm], " " -> ""]


5

Here is my take on this problem. errorForm[num_, err_, digits_] := Module[{exp, n, e}, exp = Floor @ Log10 @ num; n = NumberForm[num/10^exp, digits, ExponentFunction -> (Null &)]; e = NumberForm[err/10^exp, digits, ExponentFunction -> (Null &)]; Row[{ "(", n, "\[ThinSpace]\[PlusMinus]\[ThinSpace]", e, ") ...


4

Likely some duplication with existing answers but I felt like playing with this one. I'll use Format so that the underlying representation does not change. a_ ± b_ ± c_ := PlusMinus[a, b, c]; Format[b_?NumericQ ± err_?NumericQ ± acc_Integer: 6] ^:= Row[{ "(", NumberForm[Row[{b, err}*10^-#, "±"], {acc, acc}, ExponentFunction -> (Null ...


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


4

$PlotTheme is exactly the included mechanism for setting a global Plot Theme: $PlotTheme gives the default setting for the option PlotTheme for graphics functions. To declare this "dodgey" without further explanation is rather peculiar. Many System parameters are configured the same way: $Pre, $Post, $PreRead, $PrePrint, $MessagePrePrint, ...


2

First of all, I don't see any need for the Notation package here. So I'll just omit that. Also, you need to replace -> by :> in the definition for c, otherwise a may be polluted by a global value. The rest can be done as follows: (*Creates a subscripted integer*) fock[n_Integer, m_] := Subscript[n, m] (*Creates a series of 0's indexed from 1 to nm*) ...


2

Since you are cutting and pasting output into perl, you may find this easier than explicitly converting your output expression into input form string. Select the cell with your output. Bring up the contextual menu (right mouse click) Select Convert To > Raw Input Form The result will be


2

Thank you march for my solution: ToString[InputForm[Det[matry]]]


2

This method is based on Mr. Wizard's answer (updated for V10) to About the number format in ticks, which I discovered investigating another question, Change only tick labels while keeping default ticks, that in meantime was marked as a duplicate of this one. Since the method presented in the accepted answer by FDSg no longer works (currently the only other ...


2

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


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


1

This seems to be close to what is wanted. a1 = 0.02112398; a2 = 0.000331; f[z1_, z2_] := Module[{t, ee = Floor[Log10[Abs[z1]]]}, t = NumberForm[z1 10^-ee, 3] ± NumberForm[z2 10^-ee, 3 + ee, ExponentFunction -> (Null &)]; t RawBoxes[SuperscriptBox[10, ee]]] f[a1, a2] $$ (2.11 \pm 0.03) 10^{-2} $$


1

The issue, as I understand it, is to display a graphic with its ImageSize proportional to its "real" size. So, in an ideal world one would use something like plt=Graphics[ ... ]; plt=Show[plt, ImageSize -> AbsoluteOptions[plt, RealSize][[1,2]]/scalefactor] The problems are, there may be no Option equivalent to RealSize and, if there is, ...


1

Your problem arises from another Graphics option,PlotRange, having the default value Automatic, which gives each Graphics object its own plot range. To get what you want you will need to force each Graphics object to have the same plot range. Here is something that works for your example. I have made it a little more general than needed because I think you ...



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