Tag Info

New answers tagged

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


0

What do you think about the following substitutions? expr = Row@{x^a, Sqrt@b, ArcSin[c]}; expr /. Row@{x__} :> HoldForm@Times@x // TeXForm $ x^a \sqrt{b} \sin ^{-1}(c) $ expr2 = Row[{x^a, Sqrt@b, ArcSin[c]}, d]; expr2 /. Row[x_, y_] :> HoldForm@*Times @@ Riffle[x, y] // TeXForm $ x^a d \sqrt{b} d \sin ^{-1}(c) $


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


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:


5

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


0

x = Quantity[800, "Meters"]; x /. Quantity[a_, b_] :> Quantity[Placeholder[a], b]


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

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


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.


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


0

Eliminate the extra spaces in the alias definition: SetOptions[EvaluationNotebook[], InputAliases -> {"xx" -> "\!\(\*SubscriptBox[\(x\),\(\[SelectionPlaceholder],\[Placeholder],\ \[Placeholder]\)]\)"}] SetOptions[EvaluationNotebook[], InputAliases -> {"yy" -> "\!\(\*SubscriptBox[\(y\), \(x,y,z\)]\)"(*subscripts*)}]


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


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]


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


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}] &)] & /@ ...


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


3

Just a variant: qf[u_] := Module[{rng = Range[-24, 24, 3], multiplier = {"Yocto", "Zepto", "Atto", "Femto", "Pico", "Nano", "Micro", "Milli", "", "Kilo", "Mega", "Giga", "Tera", "Peta", "Exa", "Zetta", "Yatta"}, v, p}, v = QuantityMagnitude[u]; p = First@Nearest[rng, Log10[v]]; Quantity[ v 10^-p, (p /. Thread[rng -> multiplier]) ...



Top 50 recent answers are included