Linked Questions

0
votes
1answer
102 views

If statements with a Boolean [duplicate]

If I have a vector {1,2,3}, I want to write an If statement, where if one of the positions is "1", it will perform a certain command. ...
528
votes
19answers
132k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
180
votes
3answers
40k views

Alternatives to procedural loops and iterating over lists in Mathematica

While there are some cases where a For loop might be reasonable, it's a general mantra – one I subscribe to myself – that "if you are using a ...
28
votes
9answers
4k views

Find subsequences of consecutive integers inside a list

I have a list which is something like this: {3,4,5,6,7,10,11,12,15,16,17,19,20,21,22,23,24,42,43,44,45,46} What I'd like to to is get the intervals which are in ...
28
votes
6answers
2k views

Map-Thread-Through-Apply a list of functions onto a list of (lists of) values

I have a list of functions: fns = {f, g, h} and a list of triples: ...
8
votes
10answers
456 views

Map function on the specified location

...
10
votes
5answers
521 views

Transform a list of functions to a composition

How do I apply a list of functions in a nested way? Example: functionList = {f1,f2,f3} RequiredCommand[functionList,Pi] such that the required command returns ...
11
votes
4answers
974 views

Find list position and mapping list

Sorry, my English is not very good. I have two lists: ...
6
votes
3answers
367 views

ToUpperCases based on the original string

Suppose I have a numberic string str = "1234567456"; and another string called nstr = "05eccead24"; I want to transform ...
11
votes
2answers
282 views

Behavior of Inner depends on List dimensions?

Consider the following case: ...
7
votes
2answers
189 views

Is there a built-in function to map a list of heads to a list of data?

Assume that this built-in function is called func. What I want is func[{f,g},{a,b,c}] will return the following result: <...
2
votes
3answers
984 views

How to select elements from a list by condition?

Considering I have a list: F = {f1, f2, f3, f4} I want to perform exponent on the list F = Power[#, 2]& /@ F Now I ...
16
votes
1answer
468 views

How is the mysterious Raw function used?

I have never seen an example use for the mysterious Raw function: Raw[h, "hexstring"] constructs a raw data object with head h, and with contents ...
5
votes
3answers
205 views

Apply function to list elements only if applicable

Is it possible to apply function to list elements only if function applicable to element? For example {1.2, 3, {2.3, 5.4}, null, "fff"} Floor[%] gives ...
2
votes
0answers
316 views

Produce {f[x],g[y],h[z]} in as many ways as possible [duplicate]

I have two lists of equal lengths but for my task I will use 3-element lists , namely {x,y,z} and {f,g,h}. The first contains ...