Questions tagged [slot]

58 questions
2
votes
2 answers

slot assignment to a local variable

Let me start with an example: data = Partition[RandomInteger[50, 40], 3]; s = {10, 50}; I'd like to choose the first element of each sublist subject to the selector "s". and then find the maximum of the list by the last element. one solution is…
1
vote
1 answer

Explanation required for the Slot function

I have been trying to understand the following function l = {{1, 3}, {3, 4}}; GraphPlot[{1 -> 2, 3 -> 4, 1 -> 3, 2 -> 4, 1 -> 2, 3 -> 4}, VertexLabeling -> True, EdgeRenderingFunction -> (If[ Intersection[l, {#2}] != {}, {Red, Arrow[#1,…
no-one
  • 1,243
  • 9
  • 14
0
votes
0 answers

Trouble using list of slot variables?

When I run this code: S={a,b}; G=Subsets[S]; R=Table[SymmetricDifference[G[[i]],G[[j]]],{i,1,Length@G},{j,1,Length@G}]; TableForm[R/.({#1->1,#2->2,#3->3,#4->4}&@@G)] It works as desired, ie: It outputs: But when I do this with T being a list…
Red Banana
  • 5,329
  • 2
  • 29
  • 47
0
votes
1 answer

How I can get only second part of relation?

How I can get only the second part of this relation? I want to get Image of function where R is a relation and A is a set. Image[R_, A_] := Block[{}, For[i = 0, i < Length[A], i++, Select[#2[R]]]] But it doesn't work.
BlueMan
  • 1
  • 1
0
votes
0 answers

Understanding solution with slots

I am trying to find eigenvalues of a matrix. It has two symbols $k_1$ and $k_2$. I get this solution from mathematica Reading the doucmentation, I know # is a placeholder, much like an input to an expression. But I have no inputs to give. My…
Zero
  • 303
  • 1
  • 8