Tag Info

Hot answers tagged

7

x = E^-n (2 E^-1 + E^2) + E^n (2 E^-2 + E); x /. Times[a_, b_] :> Times[a, ExpToTrig@b] E^n (E + 2 Cosh[2] - 2 Sinh[2]) + E^-n (2 Cosh[1] + Cosh[2] - 2 Sinh[1] + Sinh[2])


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


4

I post this for illustrative purposes. You can access values. I suggest looking at the properties of your model, e.g. if your model is nlm then nlm["Properties"]. Some data and model: wd = WeatherData["Brisbane", "Temperature", {{2004, 1, 1}, {2013, 12, 31}, "Day"}]; vl = QuantityMagnitude /@ wd["Values"]; bnl = ...


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


2

Addressing only the second part of the question it may be solved using: ListLinePlot[Table[n^(1/p), {p, 4}, {n, 10}], PlotMarkers -> {Graphics[{{White, Disk[]}, {Thick, Circle[]}}], 0.05} ] When the first argument of Graphics is a list the style directives are prefixed. Related: How to make PlotMarkers constructed from Graphics track plot style? ...


2

Let me start with the second question first as it is more direct. You can see for yourself how these inputs work: f @ x x ~f~ y x // f f[x] f[x, y] f[x] The first and third only work with a single argument. Similar to but distinct from the first is @@ which is shorthand for Apply, and it allows: f @@ {x, y} f[x, y] Here the Head List is ...


1

According to my basic understand of these notations: For infix notation, the function must be a binary operator, e.g. g[x_, y_] := x^2 - y^2; Then 5~g~2 Gives 25-4=21 For postfix notation, the function must take one argument f[{x_,y_}]:=x^2-y^2 So {5,2}//f gives 21


1

Mr. Wizard's answer is excellent. My main addition would be that the advantage of the method we chose is that the output is editable: you can copy it to another cell, add/remove/change terms, revaluate, and it all just works. Using Interpertation as suggested would have preserved the meaning upon reevaluation but at the cost of destroying all editability. ...


1

Keep the LHS of the replacement rule as simple as possible, e.g., use b -> 1/a {a b, a b c, a a b} /. b -> 1/a {1, c, a}



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