Linked Questions

8 votes
1 answer

Understanding Part and Span operating on expressions with heads that are not List [duplicate]

I hope this is not a duplicate. I do not understand how does the Part and Span functions work on this expression: ...
mmal's user avatar
  • 3,508
1 vote
0 answers

Why is Part designed to sometimes wrap the original head around the parts it extracts? [duplicate]

For me, the natural meaning of the function Part is "get the sub-expression at appointing position." It is quite unlike Take, <...
Eric's user avatar
  • 1,191
44 votes
6 answers

Mathematica Destructuring

Context I'm writing a function that look something like: ...
user avatar
52 votes
2 answers

Scan vs. Map vs. Apply

I cannot understand the difference between Apply, Scan, and Map. I have tried to play with ...
MOON's user avatar
  • 3,864
23 votes
4 answers

Elegant manipulation of the variables list

I have a list of global variables (some of them are indexed variables), for example: varsH = Hold[U0[1], U0[2], B0, V0[1], V0[2]] Or (if it is easier to handle) ...
Alexey Popkov's user avatar
16 votes
3 answers

Assigning values to a list of variable names

As part of a calculation I need to do something like this Evaluate[{aaa, bbb, ccc}[[ index]]] = {1, 2, 3, 4, 5} so if index is ...
BlueMac's user avatar
  • 711
7 votes
4 answers

Inverting replace direction

I just have a simple problem. I have a list such that, rep = { a1 -> b1, a2 -> b2, a3 -> b3}; I want to invert replace direction such that, ...
Saesun Kim's user avatar
  • 1,810
9 votes
3 answers

Accesing keys based on position in an association

I would like to have the following simple function GetKey[] on a very large association. ...
Iconoclast's user avatar
14 votes
2 answers

How to REALLY Hold arguments and capture FullForm?

I'm trying to write an expression deconstructor or FullForm-capturer; might even call it a parser, maybe, but that might be too glorious a word. I got some great ...
Reb.Cabin's user avatar
  • 8,661
15 votes
1 answer

Is there a summary of answers Head[] can give?

Sometimes you need to check for the type of an expression. You use Head[data] to get answers. Some data: ...
Hp Radojewski Schäfer Von's user avatar
19 votes
1 answer

List manipulation to build a functional expression

Since Mathematica deals with Head[a, b] as an expression in this way The first Part of Head[a, b] is ...
Life's user avatar
  • 660
11 votes
3 answers

Issue with very large lists in Mathematica

I have a need to work with very large arrays of data in Mathematica. The length of the list is not known upfront. The typical size is a few hundred thousands elements and could easily go beyond a ...
Konstantin Konstantinov's user avatar
3 votes
3 answers

How to exchange two arguments?

Recently, I have being using Mathematica to write my undergraduate paper. I want to use two pattern lists such as { A -> a, B -> b, c -> C, ....} and ...
user avatar
20 votes
1 answer

How to get Cases to wrap results in an arbitrary head?

A number of functions provide for results to be wrapped in an arbitrary head. This is very important in cases where the results should not be evaluated. Take Level...
Mr.Wizard's user avatar
  • 272k
6 votes
4 answers

Expression manipulation: Explode sums and products? [duplicate]

I wonder if the functionality exists to explode a sum, or product? What I mean by that is the following. Imagine, you have input data data = a + b c - d e f ; Is ...
Kagaratsch's user avatar

15 30 50 per page