Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [slot]

The tag has no usage guidance.

0
votes
0answers
37 views

How a multilevel named slots can be written in one pure function [duplicate]

Learning mathematica now. Really curious how such a pure function should be written, i.e., an APIfunction that will return a dataset (TargetDataset) record from the string in a http request matching ...
0
votes
1answer
65 views

Convert a piecewise definition of a single impulse into an impulse train

NOTE: See update at end of question I have a function smoothstep (based on the derivative of a smoothstep function) that gives a single impulse as follows: ...
12
votes
1answer
793 views

Meaning of ## #

While looking for an answer to a different problem, I came across the following example: In[1]:= Array[Plus[##] &, {2,2}] Out[1]= {{2,3},{3,4}} Having read ...
0
votes
1answer
77 views

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 ...
4
votes
2answers
329 views

Drop 1st element of {#a, #b, #c} &

I pass the following to a function: {#a, #b, #c} & These are keys that are used in a list of associations. There are instances where I want to pass only the ...
4
votes
1answer
45 views

Combination of Scan[] and MapIndexed[]. Using an expression with slots corresponding to different functions [duplicate]

If I want to use slots corresponding to different function, how can I dod that. For example: Scan[MapIndexed[(#1+#2)*#3&,{"a","b","c"}],Range[5]] where I ...
1
vote
0answers
79 views

Understanding Maps and slot

Going through some old code I found this line: ...
0
votes
2answers
99 views

Mapping slots over lists

In the meantime I'm accustomed to write special character orgies like D[%,#]&/@L (to quickly fish out the coefficients of the last input with respect to ...
9
votes
2answers
239 views

Applying Function with SlotSequence and Lists

I would like to apply a function to a list of lists, while using each of the 2 elements of the list in a SlotSequence in two different places in the function. What I am working with is ...
3
votes
2answers
140 views

explanation of #1 and #2 [duplicate]

EDIT: This was marked as a possible duplicate. While the referenced other question does talk about slots, my question is more about how to understand how multiple slots (#1 and #2) work. Also, my ...
3
votes
0answers
38 views

Missing values vanish from expressions with DateObject and slot-lookup?

Missing value vanishes when adding or subtracting DateObject but only when slot-lookup is used, in an Association query: Given ...
2
votes
2answers
62 views

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 ...
0
votes
0answers
44 views

Pure function slot delivery [duplicate]

Another novice problem encountered. I am going to need a cardiology surgery. :( For a simple example, a = #1 &; b = #2 &; f = a^2 + b^2; f results in <...
2
votes
0answers
29 views

Bug with LinearRecurrence and Slot/SlotSequence?

The code below runs without error: LinearRecurrence[{##}, {1}, 5] Each term is the previous term squared times the index of the previous term. If the ...
0
votes
0answers
68 views

The order of evaluations with nested slots [duplicate]

I tried to join a series of evaluations with nested slots as follows: #^2 & /@ #^2 & /@ Range[10] However, the results were somewhat different from what ...
1
vote
0answers
68 views

What Does Slot Mean In Root Output and How To Translate It To Code? [duplicate]

I have the notebook below which produces the correct numerical output but the CForm function doesn't appear as though it is working correctly (or I don't know how ...
0
votes
0answers
34 views

Understanding solution with slots [duplicate]

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 ...
0
votes
1answer
90 views

How to generate a series of iterable slots in a template notebook?

How can I generate a seires of iterable slots in template notebook I can later loop over and assign values to? For example: I could generate this manually by typing out each one. However, it gets ...
3
votes
2answers
158 views

Application of # for the $n^{th}$ derivative

Let's say that I have x^2+x Is there a way to map $x$ to the first derivative of a function and $x^2$ to the second derivative of the same function? According to ...
1
vote
0answers
62 views

Applying slots, one after another for a list [closed]

For this function: Fun[x_] := 3 x^3 + 4 x^2 - 2 x - 1 I apply Map: D[Fun[x], {x, #}] & /@ Range@3 and I get this ...
1
vote
1answer
120 views

Explanation required for the Slot function

I have been trying to understand the following function ...
0
votes
0answers
26 views

Slot representing the key in Association? [duplicate]

Is there a slot representation of the Key in an Association? For instance, I would like to do same transformation with an Association: ...
7
votes
1answer
179 views

Writing code which generates a function to append many columns to a dataset

I love datasets in Mathematica. Say I have one that looks like this: ...
0
votes
1answer
111 views

Generating a function with named slots

Say I have an association: a = <|"a" -> "albatross", "b" -> "barbecue", "c" -> "champagne"|> And say I want a function with named slots to ...
11
votes
2answers
277 views

Query datasets with “variable” named slots

I want to query a Dataset object, e.g. select some entries using ...
30
votes
0answers
460 views

Front end goes wild with named slots

Bug introduced in 10 and persisting through 11.3.0 Assume the following simple expression {#"Test"}& Now go in front of the ...
0
votes
1answer
349 views

Replacing the Slot in an expression

So I've got Mathematica to handle the grunt work for me to obtain expression: Root[ (* blah, blah *) + #^2 + (* etc, etc *) ] Now, the value inside Root is a ...
1
vote
2answers
90 views

Using Apply on a function with multidimensional input

I have a user defined function which takes multidimensional input, e.g a function that takes two algebraic variables a and b as well as a matrix m and computes some rule function as: ...
2
votes
1answer
104 views

Applying Switch and Which to mixed-Key Association lists

Given an Association list w/ a common Key but also some distinct ones: ...
6
votes
2answers
140 views

Combining memoization and SlotSequence

I found myself writing memoizing code like this: ...
3
votes
2answers
621 views

How to use select and map together

I have two lists, list1 and list2. I want to Select from ...