Tag Info

Hot answers tagged

8

Looks like StringForm can achieve this: Cp = 1.5; deltastar = 0.123; Then: StringForm["The value for `1` is `2` and the value for `3` is `4`.", HoldForm @ Subscript[C, p], Cp, HoldForm @ Superscript[\[Delta], "*"], deltastar]


7

It sounds like you're merely looking for Row: Cp = 1.5; deltastar = 0.123; Row[{ "The value for ", HoldForm[Subscript[C, p]], " is ", Cp, " and the value for ", HoldForm[Superscript[\[Delta], "*"]], " is ", deltastar, "." }] If this does not work for you please clearly state how it fails so that those issues can be directly addressed.


6

The following works in both v9 and v10: style = Directive[Thick, Black]; ContourPlot[y - x^2, {x, 0, 1}, {y, 0, 1}, ContourStyle -> Directive[Thick, Black, Opacity[1]], FrameStyle -> style, PlotLegends -> BarLegend[Automatic, Method -> {FrameStyle -> style}]] The idea to use the (undocumented) Method option comes from inspecting the ...


5

I am not familiar with the specific output format you need but I think I can show you how to proceed. dat = Import["ExampleData/caffeine.xyz", {{"VertexTypes", "VertexCoordinates"}}]; dat2 = {#[[1, 1]], #[[All, 2]]} & /@ GatherBy[dat\[Transpose], First]; dat3 = {#, Length@#2, #2} & @@@ dat2; dat3 has this format: dat3 // TableForm $\left( ...


5

Defer[Quantity][Placeholder["tip"],"Meters"] or HoldForm[Quantity][Placeholder["tip"],"Meters"] The second method requires ReleaseHold to evaluate.


5

Here is a function that copies a Unicode string to the clipboard using JLink: Needs["JLink`"]; InstallJava[]; LoadJavaClass["java.awt.Toolkit", AllowShortContext -> False]; uniclip[s_String] := JavaBlock[ java`awt`Toolkit`getDefaultToolkit[]@getSystemClipboard[]@setContents[#, #]& @ JavaNew["java.awt.datatransfer.StringSelection", s] ...


4

ContourPlot[y - x^2, {x, 0, 1}, {y, 0, 1}, ContourStyle -> Directive[Thick, Black, Opacity[1]], FrameStyle -> Directive[Thick, Black], PlotLegends -> BarLegend[Automatic]] /. HoldPattern[PlotRangePadding -> Automatic] :> Sequence[FrameStyle -> Thick, PlotRangePadding -> None]


4

You can also use Inactive in V10, of course the appearance will be slightly different. Inactive[Quantity][Placeholder["Tooltip"], "Meters"] And use Activate to evaluate it:


4

rP = 1024; n = 10; roots = {0, 2, 4, 6}; freq = {20, 15, 10, 5}; rxf = {0, 30, 40, 30}; header = {"Degree (n)", "Real Roots (r)", "Frequency (f)", "r x f"}; footer1 = {"sum", "", Sequence @@ (Total /@ {freq, rxf})}; footer2 = {"average", "", "", N[Total@rxf/rP, 3]}; table = Sequence @@ (Prepend[#, ""] & /@ Transpose[{roots, freq, rxf}]); Grid[{header, ...


3

Sure hope there is an easier way than the following tf = TableForm[{{1}, {3}}, TableHeadings -> {{"t111111", "t2"}, {"Values"}}] RawBoxes[ToBoxes@tf /. HoldPattern[ColumnAlignments -> _]:>(ColumnAlignments -> {Right, Left})] tf = TableForm[{{1, 2, 3}, {3, 4, 5}},TableHeadings->{{"t111111","t2"},{"Val1", "Val2", "Val3"}}]; ...


3

In V10 there is a new function StringTemplate that allows us to build custom formatting functions in a new way. Here is how it can applied to the OP's problem. fmt[args__] := Style[ StringTemplate[ "The value for `1` is `2` and the value for `3` is `4`.", CombinerFunction -> Row ][args], "SR"] cpForm = ...


3

If I understand your question correct, you actually want to have an Accuracy of 50 and not a Precision of 50. If you use Export["oscillatorwf_n0.dat", N[oswf0, {Infinity, 51}]] the exported numbers will have a precision of 50 or less. (Less, if they end with zeros.) 2.79918439290959673893721788332716676696872559e-6 ...


3

If I understand what you want, the trouble is that final zeros are truncated. Using NumberForm can fix that. oswf0 = {1/(E^(25/2) π^(1/4)), 1/(E^(81/8) π^(1/4)), 1/(E^8 π^(1/4)), 1/(E^(49/8) π^(1/4)), 1/(E^(9/2) π^(1/4))} ExportString[ NumberForm[#, Round@Precision[#], NumberFormat -> (Row[{#1, If[#3 == "", "", "e"], #3}] &)] & /@ ...


2

a = 1.5; b = 0.123; Grid[{{"The value for", RawBoxes[SubscriptBox["c", "p"]], "is", a, "and the value for", RawBoxes[SuperscriptBox["\[Delta]", "*"]], "is", b}}]


2

The following works in Version 9.0.1.0 and Version 10.0.1.0 BoxForm`$UseTemplateSlotSequenceForRow = False; {x^a, Sqrt@b, ArcSin[c]} // Row // TeXForm (* x^a\sqrt{b}\sin^{-1}(c) *)


1

This is my attempt at producing the output style that you desire where i have assumed that all co-ordinates should be padded with three zeroes at the end. data = Import[ "ExampleData/caffeine.xyz", {{"VertexTypes", "VertexCoordinates"}}]; Gather co-ordinates of same elements table = Table[ If[data[[1, #]] == data[[1, i]], Sow[N[data[[2, i]]/100]], ...


1

leftpad[list_] := With[{blanks = StringJoin /@ Map[Table[" ", {#}] &, Max[#] - # &[StringLength /@ list]]}, Map[StringJoin[blanks[[#]], list[[#]]] &, Range @ Length @ list]] keys = {"a", "abcd" , "abc", "ab"}; vals = Range @ 4; TableForm[List /@ vals, TableHeadings -> {leftpad @ keys, {"Values"}}]


1

No idea how you can deal with four-variable functions... For a three-variable BSplineFunction, one way to see the points that satisfy f[x,y,z]== w is to use ContourPlot3D: data = RandomReal[1, {5, 5, 5, 1}]; f = BSplineFunction[data]; ContourPlot3D[f[x, y, z], {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, Contours -> {.4, .6}, ImageSize -> 500, Mesh -> ...



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