Tag Info

New answers tagged

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


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


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}


0

Use HoldForm for this: HoldForm[a a b] /. a b -> 1 (* a 1 *)


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


5

Consider this: Inactivate[3*5 - 2 - 3] // FullForm Inactive[Plus][Inactive[Times][3, 5], -2, -3] RunnyKine is correct regarding the cause but he did not really explain the mechanism involved. Formatting rules typically apply to (sub)expressions with certain heads. This has nothing to do with evaluation per se, but rather the patterns in the ...


6

Because Inactivate acts on Heads of expressions, replaces them with Inactive[h] where h is the Head of the expression and prevents them from evaluating. And in your case the Head of x y is Times: FullForm[x y] Times[x, y] So Inactivate[x y] Gives: Where the Times did not evaluate. Hence, the result you get when you apply TraditionalForm.


4

As Bob Hanlon comments the original output without Simplify is already in the form you want: efre = Sqrt[-coe // Eigenvalues] {Sqrt[1/2 (5 + Sqrt[5])] Sqrt[k/m], Sqrt[1/2 (3 + Sqrt[5])] Sqrt[k/m], Sqrt[1/2 (5 - Sqrt[5])] Sqrt[k/m], Sqrt[1/2 (3 - Sqrt[5])] Sqrt[k/m]} However, it may help to understand how to work with Simplify and FullSimplify. As ...


2

Remove["Global`*"] coe = k/m SparseArray[{{i_, i_} -> -2, {i_, j_} /; Abs[i - j] == 1 -> 1}, {4, 4}]; efre = Sqrt[k/m] *Simplify[Sqrt[-coe // Eigenvalues]/Sqrt[k/m]]; evec = coe // Eigenvectors // Simplify; Column[Subscript[\[Omega], #] & /@ Range@4 == efre // Thread, Spacings -> 2]


3

In this case, it is advisable to use the Export command: Export["test", data, "Table"] Leads to: Alternative one can use TableSpacing i.e. manipulate space between rows or columns, OutputForm[TableForm[data, TableSpacing -> {0, 0}]] >> "test" this leads to; Edit One can control Accuracy by: data1 = SetAccuracy[RandomReal[{-1, 1}, {3, ...


3

This behavior is present in both version 7 and version 10 (Windows). Illustrated: IdentityMatrix[2] // matrixform {{1, 0}, {0, 1}} // matrixform There is a difference between {{1, 0}, {0, 1}} and (the evaluated form of) IdentityMatrix[2]: the latter is a packed array. {{1, 0}, {0, 1}} // Developer`PackedArrayQ IdentityMatrix[2] // ...


2

I can't explain this strange behaviour of GridBox. But replacing it with Grid I get the desired output (also with a.a // matrixform) matrixform[mat_] := TraditionalForm[ DisplayForm[ RowBox[{StyleBox["[", SpanMaxSize -> \[Infinity]], Grid[mat], StyleBox["]", SpanMaxSize -> \[Infinity]]}]]]; To align the numbers properly use Grid[mat, ...


0

TeXForm /@ {x^a, Sqrt@b, ArcSin[c]} // RowBox // DisplayForm $x^a\sqrt{b}\sin ^{-1}(c)$



Top 50 recent answers are included