Linked Questions

0
votes
1answer
124 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. ...
578
votes
19answers
147k 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 ...
196
votes
3answers
47k 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 ...
31
votes
9answers
6k 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 ...
30
votes
7answers
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
476 views

Map function on the specified location

...
11
votes
5answers
589 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
1k views

Find list position and mapping list

Sorry, my English is not very good. I have two lists: ...
6
votes
3answers
372 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
3answers
234 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: <...
11
votes
2answers
325 views

Behavior of Inner depends on List dimensions?

Consider the following case: ...
2
votes
3answers
1k 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
496 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
279 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 ...
3
votes
2answers
70 views

Applying transformation rule for corresponding indices?

I have two lists, that looks like below list1 = {a, x, b, x, x, c}; list2 = {2, 3, 4, 5, 6, 7}; Any time there is an x in the ...

15 30 50 per page