Tag Info

Hot answers tagged

13

As djp explains parentheses are unnecessary in the FullForm of an expression; it is logical for superfluous information to be removed. However if you want parentheses to persist you could use something like this: $PreRead = # /. RowBox[{"(", body___, ")"}] :> RowBox[{"paren", "[", body, "]"}] &; MakeBoxes[paren[body___], form_] := ...


11

So recently I've learned from John Fultz that RawBoxes are kind of verbatim indicator for MakeBoxes which is not well stressed out in documentation. This or I've missed the point but it doesn't matter, here we have handy way to do this: x = 5; ToExpression @ MakeBoxes[RawBoxes["x"] = 123]; x 123


8

You can make them an expression if you want. Let par[x.....] represent (x....). For example: (x+y)*z The FullForm would be: Times[par[Plus[x,y]], z] But in every such expression, the par[..] would only ever have on argument (in the example, Plus[x,y]). It would never modify the meaning of the argument. So in FullForm, there would be no point having ...


5

This answer is in the same spirit as Kuba's answer, but it avoids conversion between boxes and expressions. Here is our workhorse mark::usage = "Use in combination with markedExpression"; markedExpressify::usage = "Use mark to mark strings for conversion to expressions"; markedExpressify[expr_] := Module[{pos, hCExpr, ext, thr, rLH, expresser}, ...


4

Preamble There are some important differences (or, more precisely, features of Function which can't be reproduced with symbols and rules), that have not been reflected in answers here, but that I think deserve a separate answer. These are related to some more advanced uses, involving evaluation control, closures, and garbage collection. Emulating Hold ...


4

Version 9.0.1.0 (Windows 8 64-bit) In version 9.0.1.0 (Windows 8 64-bit), both PropertyValue and SetProperty work as expected: x = Graph[{1, 2, 3, 4}, {1 <-> 2, 3 <-> 2, 3 <-> 4, 1 <-> 4}, EdgeWeight -> {1, 10, 30, 60}, VertexLabels -> "Name", EdgeLabels -> "EdgeWeight", ImagePadding -> 20] PropertyValue ...


3

E.g.: SparseArray[Band[{1, 1}] -> Infinity, {3, 3}, 2] // Normal Creates a 3×3 with 2 everywhere but the diagonal of infinity. Drop the // Normal if you want to keep it sparse...


3

Let's look at using Reduce on your problem. First we will define your function p[t], then assign parts of your problem to a couple of variables to make this easier to see and finally try using Reduce to see when the sign of your expression will be negative. Note: Your p[t] doesn't depend on t. Is this perhaps a typo or did you mean something different? ...


2

Is it not just this? g[r_,θ_,ϕ_] := Sum[Sum[f[l, m] r^l SphericalHarmonicY[l, m, θ, ϕ], {m, -l, l}], {l, 0, ∞}]


2

Perhaps you want PolynomialGCD instead of GCD: PolynomialGCD @@ Denominator@*Together /@ Flatten[mL] (* 32 h *)


2

lp = 10; uu = Table[Subscript[u, i], {i, 1, lp + 1}] You can use MapAt to add 4 to Part 2 of all elements in uu MapAt[4 + # &, uu, {{All, 2}}] Or use ReplaceAll to replace the second part of Subscript[a, i] to Subscript[a, i + 4]: uu /. Subscript[a_, i_] :> Subscript[a, i + 4] Alternatively, you can assign new values to ...


2

Mathematica does not like your h[i]s. If you introduce shrt[head_, indices_] := ToExpression[StringJoin[ ToString /@ Flatten[ {head, indices}]]] so that e.g. shrt[h,1] becomes h1 or shrt[h,{i,j}] hij Then this works: S = 10^-9.2; cl = 3*10^8 ; f = 5.9*10^9; w = cl/f ; A = (4*π/w)^(2/1); β = 2.5 ; m ...



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