# Tag Info

26

Clearly the @ notation is inspired by the usual mathematical notation for function composition. f@g[x] looks very similar to the mathematical notation $(f\circ g)(x)$. But it is important to understand that @ does not denote function composition. In mathematical notation $f\circ g$ is also a function. In Mathematica f@x is simply a different way to ...

18

Try this: Map[If[#==1,Unevaluated@Sequence[],#]&,{1,2,3}] Note the output. The 1 is gone. That's because Unevaluated@Sequence[] puts the empty sequence there, that is, "nothing". ##&[] is a shorthand that can be used in most places for same - ## is the sequence of arguments, & makes it a function to apply to something, [] is that something - ...

9

... why introduce Composition as a new feature? Composition is used to create a new anonymous function that can be used in all the standard ways such as Map and Apply etc. To achieve the same thing without it one needs a Function. Much like operator forms the use of Composition allows one to eliminate extraneous Function constructs which can make code ...

8

Also PlotRange[plot] PlotRange /. AbsoluteOptions[plot] Last @@ AbsoluteOptions[plot, PlotRange] PlotRange /. plot[[2]] all give (* {{0.,10.},{-0.999999,1.}} *) Note: Regarding usage of PlotRange as a function, it is undocumented, and the earliest reference I could find on this site is this answer dated Oct 11, 2012: The same range on each plot in a ...

7

I believe it is important to get a fundamental understanding of what Pure Functions are that goes beyond the understanding using of a syntax. Hereafter an non-exhaustif summary of a few key understandings: 1) Pure Functions have they roots in Lambda calculus that forms the basis of functional programming paradigm implemented in Mathematica. 2) In ...

3

FilterRules[AbsoluteOptions[plot], PlotRange] does the trick (*{PlotRange -> {{0., 10.}, {-0.999999, 1.}}} *) Not sure if this is an exhaustive answer.

2

Anyway, while I wait for my flight, here's some code that'll give you everything there is to know about a plot. GetGeometry[g_Graphics] := Module[{ q, dim, plotrange=PlotRange/.AbsoluteOptions[g,PlotRange], }, q=Rasterize[Show[g, ...

2

You can use val -> lbl syntax for SetterBar: SetterBar[Dynamic[vAwG], Thread[# -> MatrixForm /@ #] & @ vAwGOptns, FrameMargins -> 15]

2

Your assumptions are most probably wrong, it seems that this function is meant to change CellStyle. e.g. use this code to convert Input cells to Title cells in current notebook: ( SelectionMove[#, All, Cell]; MathLinkCallFrontEnd[FrontEndSelectionSetStyle[#, "Title"]] ) & /@ Cells[CellStyle -> "Input"] Used here: Set the style of a cell ...

2

The fundametal problem is here: Pnt = Append[Pnt, {X, Y}] && Break[] The Break is evaluated and exits before the assignment. Just do this: Pnt = Append[Pnt, {X, Y}] ; Break[] That said Reap/Sow is a better way to go: Bleh[n0_] := Module[{iteration = 1000, error = 10^(-10), denominator = 10^(-10)}, Last@Reap[ Table[ X = ...

2

Here's a quick&dirty&buggy solution for your two wishes, although I strongly suggest you to do you works the way as the notebook interface designed to. Cls := (SelectionMove[InputNotebook[], All, Notebook]; FrontEndExecute[FrontEndToken["Clear"]]); $Post = (If[Head@$outputNB == Symbol, $outputNB = CreateNotebook[]]; If[# === Null, 1;, ... 2 Well, n[1, 1, 1] (* {1.38996, 1.85383, 1.37325} *) n[5, 5, 5] (* {1.38996, 1.85383, 1.37325} *) When you first define your variables and then assign n[...] to this expression, the expression will evaluate and then be stored as that value. Regardless of what values you pass to n it will always return the same thing. You can read more about how Mathematica ... 2 In addition to what I've said in comments, you can write your function in shorter form: letterIndex2[l_, rot_: 0] := Mod[First@ToCharacterCode[l] - 64 + rot, 26, 1] 1 The reason is that dimension of matrices are not compatible. a = {{-1}, {0}, {0}} Dimensions[a] (* {3, 1} *) b = IdentityMatrix[3] Dimensions[b] (* {3, 3} *) c = {a, b} Dimensions[c] (* {2, 3} *) d = {{7}, {2}, {0}, {0}} Dimensions[d] (* {4, 1} *) If you multiply a$m \times n$matrix by a$n \times l$matrix, you get a$m \times l\$ matrix. ...

1

You could add set back to your EdgeShapeFunction: EdgeShapeFunction -> (If[#[[1]] != #[[-1]], {Arrowheads[ If[#2[[1]] == chr, {{0.04, 1}}, {{0.02, 0.2}, {0.02, 0.8}}]], Arrow[BSplineCurve[{#[[1]], {0, 0}, #[[-1]]}, SplineWeights -> {2, 1, 2}], .025]}, Opacity[0]] &)

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