Tag Info

Hot answers tagged

10

Mathematica 10 introduces IntegerName: IntegerName[n] gives a string containing the full English name of the integer n. IntegerName[n,"type"] gives a string of the specified type. Possible types include: "DigitsWords" a combination of three-digit numbers and words "Words" using only words "Approximate" the first few digits ...


6

You people with your fancy version 10 have it too easy. StringJoin@Reverse@MapIndexed[ToString[#] <> {"", " thousand ", " million ", " billion ", " trillion" }[[First@#2]] &, Reverse@(FromDigits /@ Partition[PadLeft[#, 3 - Mod[#, 3, 1] + # &@Length@#] , 3])] &@ IntegerDigits[123456789] "123 million 456 ...


5

As an example cities = EntityValue[CountryData["UnitedStates", "LargestCities"], "Name"]; first = First@cities rest = Rest@cities; data = WolframAlpha[ StringJoin["moving from ", first, " to ", #, " $42,500"], {{"PriceComparisons", 1}, "ComputableData"}, PodStates -> {"PriceComparisons__Show prices", ...


3

I hope I understand the question. I have interpreted this is wishing to display an expression in a particular form. f /: MakeBoxes[f[n_, x_, num_], StandardForm] := RowBox[{SubscriptBox[ RowBox[{AdjustmentBox[SuperscriptBox["", MakeBoxes[n]], BoxMargins -> -0.15, BoxBaselineShift -> -1], MakeBoxes[Style["C", Italic, 20], ...


3

In version 9 and earlier you can do it with Riffle and IntegerDigits[...,1000]: name[n_Integer] := If[n < 0, "minus ", ""] <> Riffle[ToString /@ IntegerDigits[n, 1000], {" thousand ", " million ", " billion ", " trillion "}, {-2, 2, -2}] {#, name@#} & /@ ((-12)^Range@10) // TableForm


3

Update 2: Rather than processing the table m to add headers, we can define a function modifyF that modifies f to return first and/or second argument passed to f for specific argument patterns; and, then use modifyF[f] to construct the table. One way, out of many ways, to do that is: ClearAll[modifyF]; modifyF[f_] := {##} /. {{_String, a_} :> a, {b_, ...


3

(*auxiliary functions*) wrap = Function[item, Pane[item, {90, 90/GoldenRatio}, FrameMargins -> 0, ImageMargins -> 0, Alignment -> Center] , Listable]; grid = Grid[#, Spacings -> {0, 0}, Alignment -> {Left, Center}] &; (*I don't know what you are doing so I'm making up data:*) data ...


3

I decided to edit the title and answer this question as wiki because I think it is not easy for new users to find this kind of information. The more if they are not aware of special handling of ? ! in search fields. So the explanation of things like: \!\(TraditionalForm\` c (1 + x)\) is in the tutorial String Representation of Boxes. Here are ...


3

If absolutely another way is needed: Interpreter["ComputedNumber"]["ArcCosh[e^1.5400733368255632]"] (* 2.2215292111560915 *)


2

list1 = {{0, 0, 0, 0}, {0, 0, 0, 1}, {0, 0, 1, 0}, {1, 1, 1, 1}}; list2 = {1, 5, 5, 5}; Grid[Prepend[Transpose[{Row[{"(", Row[#, ","], ")"}] & /@ list1, list2}], {"Initial Vector", "Period"}], Dividers -> {2 -> True, 2 -> True}] or Grid[Join[{{"Initial Vector", "Period"}}, Transpose[{Row[{"(", Row[#, ","], ")"}] & /@ ...


2

ArcCosh[E^1.5400733368255632] 2.22153 or ArcCosh[Exp[1.5400733368255632]] 2.22153 And, if you want more digits in the output NumberForm[%, 16] 2.221529211156092


2

This might be of help: $OutputForms is a list of the formatting functions that get stripped off when wrapped around the output. $OutputForms= ...


2

The OP's basic approach seems to work for me, although the code for rss doesn't work because zcol etc. are arrays, not functions. Assuming you want the sum of squares of the residuals, here is an example fix: {xcol, ycol, zcol} = RandomReal[{-10, 10}, {3, 20}]; Clear[DefineRSS]; DefineRSS[a_?NumericQ, b_?NumericQ, c_?NumericQ] := ( rss = Total[(zcol - ...


2

Perhaps this will work for you: MakeBoxes[Superscript[b_, x_, y__], form_] ^:= ToBoxes[Superscript[b, Row[{x, y}]], form] Example: Sum[Superscript[G, a, b], {a, 1, 2}, {b, 1, 2}] $G^{11}+G^{12}+G^{21}+G^{22}$


2

Of OP's two requirements center the column headings and remove all the trailing decimal points. @bbgodfrey's answer addresses the second. Unfortunately, getting both requirements, i.e., to center just the column headings while keeping the values decimal/right aligned. using TableForm is impossible since TableAlignments is not flexible enough to ...


1

If it is C-like syntax you are after, CForm is your friend: CForm[Binomial[(10000000-1),x]*(1/2^24)^x] outputs Binomial(9999999,x)/Power(16777216,x) To better preserve the original formula you gave, you can use: CForm@HoldForm[Binomial[(10000000-1),x]*(1/2^24)^x] which outputs Binomial(10000000 - 1,x)*Power(1/Power(2,24),x) Update As you seemed to ...


1

Is this what you had in mind? cosine[r_, theta_] := Sqrt[2 r^2 (1 - Cos[theta/360*2*Pi])]; m = Table[IntegerPart[cosine[r, t]], {r, 1000, 10000, 1000}, {t, 0.5, 2., .5}]; rows = Range[1000, 10000, 1000]; TableForm[m, TableHeadings -> {rows, {"0.5", "1.0", "1.5", "2.0"}}, TableAlignments -> Right] Note that m is undefined in your question, but I ...


1

?? Gamma or Information[Gamma] will yield all the information available through Mathematica.



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