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

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


5

EDITED to include Mr.Wizard's replacement for Switch EDITED to cover additional cases Roll your own: quantityWithAppropriatePrefix[quant_Quantity] := Fold[UnitConvert[#1, #2] &, quant, {"Imperial", "SI"}]; quantityWithAppropriatePrefix /@ {Quantity[0.0000011, "Meter"], Quantity[0.0000033, "Feet"]} {Quantity[1.1, "Micrometers"], ...


5

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


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


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]


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


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


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


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


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