The map tag has no wiki summary.
6
votes
2answers
102 views
Variable scoping problem when mapping over delayed replacement
This is something that got me curious while I was playing around with Mathematica.
Consider the following (contrived) example:
...
5
votes
1answer
64 views
How can I substitute something using only map?
For example, I have the equation
x^2 + y^2 == x*y
and I want to apply the rule
y -> s*x
I can do it easily by
...
1
vote
4answers
144 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:
...
5
votes
1answer
104 views
nested use of Apply/Map/MapThread in pure functions
1. My main question
I have a function with two argument slots. I wan't to apply this function to 2 lists with different length's. I thought in this solution:
...
1
vote
2answers
53 views
How to construct a new list made from a function that operates on two lists
I need to take two lists (each list contains the number of moles of a chemical). I have a function calledFraction that takes the each entry of the list and then calculates the mole fraction of ...
1
vote
3answers
72 views
Placeholders for map inside a map
I have a list structured like
list1 = {{"header1","header2","header3"},
{0,1,2}};
and I'm using a custom function to find the number of the column with a ...
3
votes
3answers
110 views
Dynamic application of several polynomials
I know how to get the 'resulting image' (y) from the application of a certain function (f) (here represented as the coefficients of a polynomial) over a certain interval (x):
...
0
votes
0answers
58 views
Mapping a function to a Matrix [closed]
I’ve looked up previous answers to this question but haven’t found a suitable answer.
I am trying to Map a function that I defined across a Matrix. The function Maps fine across a 1D array but can’t ...
2
votes
1answer
105 views
Issue with ListConvolve
I am a new Mathematica user, learning the intricacies of functional programming. I have issues withe applying a function over a moving list. My function seems to work and give correct results but it ...
2
votes
2answers
87 views
Using DeleteCases and Map together
Given:
list1 = {{"a",1},{"b",2},{"c",3}}
I would like to delete any pair in list1 that does not have a first element that belongs to list2.
Example 1: If ...
2
votes
2answers
199 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 ...
1
vote
2answers
142 views
Thread over a nested list top to bottom until non-list elements are found
I have a nested list:
list = {1, 2, {3, 4}, f[a], {2, h[b]}}
I would like to apply a function g to all elements of the ...
5
votes
2answers
118 views
Nested Map and Apply
There are some other questions on this topic but I could not get an answer from reading them. What I want to do is use Apply on some of the arguments of a function, ...
0
votes
0answers
70 views
How to map over non-Null values in a list [duplicate]
Possible Duplicate:
Selectively Mapping over elements in a List
I have a list of distributions and a list of samples. I'm trying to calculate probabilities of some record being within one ...
6
votes
2answers
192 views
Map a function over the columns of an M x N array
I have a $N \times M$ list of lists, or rather, a list of records and I want to map a function over its columns (e.g. find the mean temperature, age, etc.). Map ...
5
votes
3answers
142 views
How do I designate arguments in a nested map?
Say I have two lists,
list1 = {a, b, c}
list2 = {x, y, z}
and I want to map a function f over them to produce
...
0
votes
0answers
145 views
Why does Do or Table really slow down this code?
I have some function that usually executes pretty quickly:
logf[x_, y_] := N[f[x, y], 40] /. v_ :> (PutAppend[Unevaluated[f[x, y] = v;], "myfile.txt"];);
...
8
votes
4answers
289 views
What's fastest way of defining 10^5 down values?
I want to define
isGood[___] = False;
isGood[#] = True & /@ list
where list is a list of several million integers. ...
1
vote
0answers
53 views
Evaluation in mapping constructs [closed]
I'm trying to use ReplacePart inside of Map, where the address of the element being replaced is the domain of the map, like this:
...
3
votes
3answers
350 views
Map w/ multiple arguments [duplicate]
Possible Duplicate:
How do I use Map for a function with two arguments?
If I have a function:
F[x_,y_,z_]:=x*y*z
and I want to call it with several ...
23
votes
12answers
814 views
Map a function across a list conditionally
It seems that this is a really basic question, and I feel that the answer should be obvious to me. However, I am not seeing. Can you please help me? Thanks.
Suppose I have a list of data ...
7
votes
3answers
241 views
how to efficiently apply function to all pairs of a set (and collect the results)
To build a graph, I need to apply a function f[a_, b_] to all pairs of a list (3500 elements). The function itself returns a link ...
1
vote
2answers
144 views
Expectation over a list with nested-mapped expressions
I need expected values of a list where the random variable to take expectations over should be an input into expressions defined earlier. I suspect Set[] and SetDelayed[] tripped me. (Or Map and ...
