# Tagged Questions

Questions about applying functions or operators to expressions, especially constructs that take advantage of Map (/@) functionality.

35 views

### Trying to understand Function with Sequence, Map and Block (FormCalc, FeynArts)

I am trying to understand some functions of FeynArts and FormCalc (http://www.feynarts.de/), but I don't have a clue what this function does (in Analytic.m): ...
62 views

### Mapping a simple 2 variable function

Quick Question: What is the best way to map this function so it performs seperately for 102 different values of x? ...
93 views

### Fourier transformation of multidimensional list [closed]

x is a list containing 7 trajectories (Dimensions[x] = {2726, 7}) of which I want to calculate the FFT. ...
86 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 ...
2k views

### Scan vs. Map vs. Apply

I cannot understand the difference between Apply, Scan, and Map. I have tried to play with ...
74 views

### Mapping over function's several parameters regions [closed]

About this post: Mapping multiple parameters of a function to specific values I wonder if the parameters a and b have ranges ...
51 views

### Map over multidimensional matrix [closed]

Suppose I have a 8by6by4by2by2 matrix called m. There is in total 8*6*4 2by2 matrices. I want to map a function over these 2by2 matrices. Each dimension in ...
78 views

### Using Map instead of For?

Since i am new to mathematica i tried to do some code with several for-loops. However i saw that mathematica is not efficient with for loops and discovered some functions like map etc. So my question ...
62 views

### How to output the entries of two lists as equal without evaluation? [closed]

Question So, for example, I have the code here: ...
62 views

### Distinguish hashtag # operator when using multiple functions [duplicate]

I would like to do this list = Append[list[[#]],Map[list2[[1, #]] & , list[[#, 4]], {2}]] & /@ Range[Length[list]]; But I would like to substitute ...
3k views

### Mapping a pure function with multiple slots [duplicate]

Here is a pure function with multiple slots: (#1^2 + #2^2)&[3, 4] 25 But how can I map that pure function over lists of values? For example, say I want ...
133 views

### Map vs listable [duplicate]

What's the difference between setting a function's attribute as Listable and using Map? I understand that ...
67 views

### Plotting Invariant Manifolds of the Henon Map

Given the following map: \begin{align} & x_{n+1}=-y_n+2x_n^2 \\ & y_{n+1}=\beta x_n \end{align} for $β \in (0,1)$, $x_n \in \mathbb{R}, y_n \in \mathbb{R}$ (which is a one parameter version ...
43 views

### Applying multiple functions to a single column in a table

I've seen similar questions, but I'm having trouble applying solutions found there to my situation. My sorting function: ...
70 views

### Calculate Cumulative Mean and Standard Deviation of a list without FOR loops [duplicate]

I have a simple list mylist={x_1,x_2,...,x_N};. Now I want to map a function over this list, e.g. the Mean and StandardDeviation functions, so that it will give me ...
168 views

### How to plot coordinates with different colors on a map?

How can I plot different sets of coordinates with different colors? For example, the two maps below would be merged into one map, with two colors. I'm using the commands below to create the maps ...
54 views

### Remove minus-signs from list [closed]

I have a list that is of the following form {-x,y,-z,a} I want this set to become this: {x,y,z,a} I tried the following: <...
62 views

### Pairing values with their indexes for MapThread

Several operations require you to map over a list of values and to know the index of each value as you process it. To accomplish this, my current somewhat ugly solution uses MapThread: ...
38 views

### Custom iterable objects

I understand that to create objects with custom behavior with respect to existing code one uses upvalues. However, I'm at loss when it comes to guess what interface is expected from objects fed to ...
69 views

### Specifying Options when using Map abbreviated form (“/@”) [closed]

I want to make /@ with some option, Like PlotRange->All ...
52 views

### A kind of function optimization problem [duplicate]

I have the following problem. Out of a calculation I got the four functions shown at the end of the post. These functions depends on many variables, qk, pk etc (all of them are actually scalar ...
501 views

### another way to do this mapping of a two argument function

Sorry, I'm just starting to learn mathematica. I have the following two-argument function: h[{x_, y_}] := x ^ y When I do the following: ...
55 views

### Importing data, then plotting ListPlot. What's the most efficient way to write a code?

It should be a boring question to ask for someone, but this is very basic need which I haven't resolved by myself. I know I can use MapThread and pure function to make it short and beautiful, but even ...
117 views

### how to map a function on a variable list

The following is just an example that captures what I want to do (more on it at the bottom). I'm trying to do something that can be paraphrased as follows: I have a global list, say ...
83 views

### Creating a list of unevaluated pure functions with Apply

Suppose I have a list list with length L and a function ...
50 views

### using Map to apply 2 lists to the LCM function - help [duplicate]

I have 2 lists of numbers and I want to quickly compute the array of answers to the LCM function for the 2 lists and a 3rd static number. I tried the following ...
99 views

### Map if-function on a list

I need to convert a battery charging mechanism from Excel into Mathematica. This Excel function is about deciding if the charge/decharge rate is positive, then multiply with efficiency factor, ...
65 views

### Fastest way to make division between a number and elements in a list [duplicate]

I have a list y={{a,b},{c,d},...} of dimension {10^5, 2}, and number x. I want to divide only the second part of each element of the list by x, and have as result a new list {{a,b/x},{c,d/x},...}. ...
842 views

### Best way to emulate MATLAB's bsxfun using Map and similar functions

Given a matrix, we want to subtract the mean of each column, from all entries in that column. So given this matrix: ...
70 views

### Map level inconsistencies with Missing values [closed]

Negative Level specs interact with Missing values, eg: ...
55 views

### Monitor CUDA function

Is there a way to monitor CUDA function without bringing much performance reduction. For example, Map can be monitored by ...
118 views

### Mapping at arbitrary nested list [duplicate]

This is a candidate for a duplicate (probably from the documentation) but I've ironically failed to find the direct analog so far. I have an arbitrary nested list, say: ...
104 views

### How to map the second highest value in each row of a matrix

I have a matrix with three or more columns called mat. I would like to map the second highest value in each row of mat into its ...
151 views

### How to make a function to analyse a sentence?

I have two lists: grammarNonterminal = {{VP,{V,NP}},{NP,{D,N}},{S,{NP,VP}}} sentence = {{D,"the"},{N,"man"},{V,"hit"},{D,"the"},{N,"table"}} I want to make a ...
46 views

### how to use a tree as a key to construct a table of key values

I have an interesting problem that I was able to summarize in the form of trees, sets, and key value pairs. I have the following sets of keys and values \begin{aligned} k_0 &= [A]...
63 views

### Creating authomatically inequalities/equations from a list of polynomials

I am trying to learn how to make automatically from a list of polynomials (or an arbitrary collection of algebraic expression) a list of inequalities/equalities (those will later serve as constraints ...
283 views

### Mapping on leaves

Say I have some nested structure, such as {a,{{b,c},d,{e,{f,g}}}}, and I want to apply a function $q$ to each of the leaves; that is, I want the output to be ...
50 views

### Mapping over two indices with a condition

How can I use Map over two indices with a condition? I am trying to calculate second derivative of an eigenvalue, $\lambda_i(x)$, of $n \times n$ matrix $M(x)$ ...
92 views

### Issue with pure function when mapping dynamic content within graphics scope

What I am trying to achieve can be described using following code: vector = {{0, 0}, {1, 0}}; Graphics[Circle[#, 1] & /@ vector] In the above, a pure ...
522 views

### Map a function of several arguments

I have three lists, e.g. list1 = {{a,b,...}}; list2 = {{1,2},{3,4},...}; list3 = {{x,y},{z,w},...}; and a function ...
108 views

### MapAt with Replace(All) causing kernel crash

Bug introduced in 10.1 and fixed in 10.2 I wanted to roll a function that works like /. but only acts on the very first match it encounters. ...
110 views

### Importing and saving .csv files as variables with the original filebasenames

I have a modest number of .csv files that I want to import into mathematica. I would like to save their contents as their filebasename for use throughout my notebook, but I am running into errors as ...
356 views

### Element-wise test on List elements

This question could sound pretty silly but I can't find a way to apply element -wise tests to a list. For example if I digit ...
111 views

### multiple maps to extract from association

I've got some code that has to extract a lot of information, including some statistics, from an association. There's a lot of repetition in my code and I'm hoping that there's some way to simplify it ...
64 views

### How to put a levelspec in operator form? [closed]

All variable argument functions need Function wrapped around them in operator form, but is there any other way to achieve this: ...
101 views

### Using Map multiple times in one command

Is there a way to reproduce the effect of Table[i ** j, {i, list1}, {j, list2}] using Map instead of Table? Specifically, I want to write something along the ...
88 views

### Perform calculation on several sublists using Map

I am trying to perform a calculation on a list containing sublists. More exact: The x-axis values are time data, progressing from zero, the y-axis data are data points, which I want to normalize. I ...
654 views

### Efficiently compute double sum

Is there a "Mathematica Way", like Map or Apply to compute the following double sum? $\sum_{i=1}^{N_1}\sum_{j=1}^{N_2} m_i n_j \, f(\tau_{i} \gamma_{j})$ I have already stored the lists \$m,n,\tau,\...