Questions on the basic structure of the Mathematica language (Wolfram language) including atomic data types, syntax etc

learn more… | top users | synonyms

312
votes
27answers
51k views

What are the most common pitfalls awaiting new users?

As you may already know, Mathematica is a wonderful piece of software. However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...
29
votes
2answers
2k views

Scan vs. Map vs. Apply

I cannot understand the difference between Apply, Scan, and Map. I have tried to play with ...
18
votes
3answers
515 views

What are the requirements for a well behaved indexed variable? Subscript, ToExpression, Downvalue?

On writing this answer I needed to call a function, (NonlinearModelFit) with an unknown number of parameters. We have learned that we should not use ...
22
votes
1answer
625 views

Shorter syntax for Fold and FoldList?

I find it tedious to write out the following: a = {1, 2, 3, 4}; Fold[f, First @ a, Rest @ a] f[f[f[1, 2], 3], 4] It ...
13
votes
2answers
12k views

What does # mean in Mathematica?

I asked Mathematica to compute the following Solve[c (1-x)^2-x^(1/4) == 0, x] and it returned this: x = Root[#1^8 c^4 - 8 #1^7 c^4 + 28 #1^6 c^4 - 56 #1^5 ...
110
votes
3answers
6k views

How to make use of Associations?

I have been curious about it for long. Now that Mathematica 10 arrives, I think it's time to ask the question: How the new Association data structure would be used ...
55
votes
1answer
1k views

Incompatible Changes since Mathematica Version 7?

There is documentation of the incompatible changes made to Mathematica with each major release: Incompatible Changes since Mathematica Version 1 Unfortunately that documentation simply stopped ...
40
votes
2answers
1k views

Why is the new PositionIndex horribly slow?

This issue has largely been mitigated in 10.0.1. New timings for the final test below are: ...
18
votes
3answers
463 views

What does None mean in a control specification for Manipulate?

I am now struggling to understand code that contains the following (simplified) Manipulate structure. ...
6
votes
1answer
1k views

Behavior of expression evaluation in Plot

I'm confused with Mathematica's way of parsing expressions. I've been struggling with this for a while and never found an exhaustive answer, sometimes things don't parse the way I think they would ...
12
votes
5answers
2k views

How to completely delete the head of a function expression

Is there any way to completely remove the head of an expression function? For example, how would I remove the head Cos from ...
53
votes
3answers
4k views

Is Mathematica an Implementation of the Wolfram Language?

I am trying to figure out what the announcement of the Wolfram Language means for Mathematica. Is Mathematica an implementation of the Wolfram Language, or is it something else?
32
votes
2answers
929 views

Is there a name for #1@#2&?

Why does the pure function # @ #2 & have no name? I'm asking because sometimes I find inelegant to write expressions like ...
27
votes
2answers
620 views

Why is Query so much slower than Part?

Time for another of these(1),(2) as yet another new-in-10 function appears to have poor performance compared to older alternatives. This time: Query appears to be ...
36
votes
2answers
2k views

Is Mathematica comparable to C++ for creating standalone applications?

At my university, I have a yearly essay. I'm allowed to use any technology for implementing it. I've been coding it in C++ with Qt. I thought of about Wolfram Mathematica because I have some ...
14
votes
2answers
451 views

Can't get Append to append a record (association) to a dataset

The Documentation Center item, Computation with Structured Datasets, implies that Append has been extended in V10 to work with datasets. But not on my computer. (I ...
14
votes
3answers
393 views

Make mathematica treat $e_i^2$ as numeric

With NumericQ[symbol] = True, I can declare that a symbol is numeric. I want the expressions matching: $$e_{\text{i$\_$}?\text{IntegerQ}}^2$$ to be treated as ...
11
votes
3answers
354 views

How do I make a string literal without having to escape backslashes?

I'd like to say something like: foo = @"\abc\def\ghi" instead of foo = "\\abc\\def\\ghi" How do I do this? This would ...
12
votes
2answers
327 views

How to restore function attributes to default

Adding an attribute to a function is easy and clearing attribute is easy also. But I don't know really how to restore the attributes of a function to its defaults. All I do is quit the kernel or close ...
10
votes
1answer
227 views

Why can't a string be formed by head String?

Since everything is an expression in Mathematica, why must a string object be formed by "abc" but not by a String[abc] ...
8
votes
1answer
379 views

Treat all variables as local in a module [duplicate]

In most languages, any variable defined inside a function is considered local. ...
4
votes
1answer
171 views

ControlType -> None Vs. Module inside Manipulate (i.e. making everything local)

I'm building a program on another one made available in the Wolfram Demonstration Project. I've noticed that in the original code (working flawlessly) many variables were made local inside the ...
19
votes
2answers
359 views

What does f_[whoCalled]^:=f really mean?

I came across the following post by John Doty in this Google Groups discussion: On Friday, January 11, 2013 8:23:16 PM UTC-7, amzoti wrote: It is clear the Mathematica uses Lisp as one ...
17
votes
2answers
511 views

I define a variable as local to a module BUT then the module uses its global value! Why?

I have a question about modules and local variables. Here's my example: h = 5; Module[{a, h}, a[h_]= h^2; a[4]] (*Out[2] = 25*) I expected the module to ...
13
votes
1answer
368 views

Is everything in Mathematica ultimately stored as a rule?

My current understanding about Mathematica is that everything, at the lowest level, ends up as replacement rules. First question: is this true? Second question: does Mathematica "gloss over" these ...
12
votes
5answers
917 views

Postfix Double Slash Notation with Multiple Parameters [duplicate]

Examples A convenient shorthand that I use frequently is the "double slash" notation to string commands together. For example, I can write: ...
5
votes
1answer
494 views

Proper use of arbitrary number of variables

So, I'm working on a project where the number of independent variables is not fixed. Consider a problem of $N$ independent variables, $\boldsymbol{r}$. I want to perform different things with them. ...
15
votes
1answer
271 views

Why won't SparseArray let me store values with the head List?

When you attempt to define a SparseArray with elements that have the head List it complains: ...
6
votes
5answers
501 views

Defining indefinitely many functions

Is it possible to define a class of indefinitely many functions f1, f2, f3, ... such that ...
5
votes
4answers
238 views

Signed power set of a list

Given {a, b, c, ...} with $n$ elements generate a list with $2^n$ elements. For example, if the list were {a, b, c}, then the ...
3
votes
3answers
204 views

How to assign symbols to functions

Several functions work with symbols in MMA: Take for example Part: l1=l2=Range[4]; l1[[3]] (*3*) l2[[4]] (*4*) I want to make ...
0
votes
1answer
98 views

How to calculate the pseudo-remainder and pseudo-quotient of two multivariate polynomials

I have fixed some code, but it always gives me errors. Can anybody tell me its right code? ...
0
votes
2answers
246 views

How to construct a linear feedback shift register

Are there any posts regarding the construction of a LFSR (Linear Feedback Shift Register) in Mathematica? I can't seem to find any and I am not sure how I would construct one.
43
votes
4answers
801 views

What's the difference between Inactive and HoldForm?

In version 10, Mathematica not only added Inactive / Activate but also highlighted this change in the "New in 10" page (in Core ...
14
votes
3answers
205 views

What does `: Hold[$IterationLimit]` mean?

In this answer, what does the : Hold[$IterationLimit] part of the following construct do? ...
16
votes
3answers
262 views

How do I understand ListCorrelate(contains $\{k_L,k_R\}$) when it works for 2-dimentional data?

Two months ago, I asked a question here And @nikie give me a solution: The intuitive way to understand ListCorrelate is that the kernel is "moved" to every ...
22
votes
3answers
735 views

Real Numbers in the Wolfram Language

Epilog: Much of the discussion in the answers below revolves around the distinction between Real as a data type and real numbers as a domain or class of numbers (irrespective of the form in which ...
21
votes
1answer
422 views

Why some built-in functions are slow

I just wonder why some built-in functions are slower compared to some other ways using more than one built-in functions for doing same job. consider this example: ...
17
votes
1answer
195 views

A bug in the overloading of MemberQ and FreeQ for Association?

Bug introduced in 10.0.0 and fixed in 10.1.0. While answering Pattern match for nested Association I came across behavior of MemberQ and ...
22
votes
1answer
799 views

Using Transpose with a list as the second argument

I'm having difficulty understanding the Transpose function. I know what the transpose of a matrix is, not a problem, and I see that applying the ...
18
votes
1answer
156 views

Help understanding overloading of Atomics within Block

Usually h @@@ {f[1, 2], f[3, 4]} === {h[1, 2], h[3, 4]} but this is not the case when f is ...
7
votes
2answers
299 views

Wolfram Language symbols by their Ranks

I'd like to get the top 50, the bottom 50 and an ordered list of all Wolfram Language symbols based on their "Ranks". With ...
5
votes
2answers
270 views

Overlapping pure functions

Let say I need and option for Plot: RegionFunction -> (-6 < #2 < 6 &) But I also want those ...
10
votes
2answers
399 views

When must I use the Return function?

In a comment to my answer to this question, QuantumDot asks, "Where can I find more information on when I must use the 'Return' function?". I found this too deep a question to be answered by leaving a ...
5
votes
1answer
218 views

How to Override the Head of a Symbol

I was wondering if it is possible to override the head of symbols/operators. As a motivating example if I run: Then Ket will be returned. But lets say I want Bob to be returned instead of Ket. Is ...
12
votes
1answer
175 views

Is there a way to control which special forms Normal converts?

Normal documentation reads: Normal[expr] converts expr to a normal expression, from a variety of special forms. But is there a way to control which special ...
10
votes
1answer
404 views

How to visualize pattern matching process?

I want a function that does the same job like ReplaceRepeated, and can make the matching process visible. I searched the Internet but didn't find any existing code ...
8
votes
3answers
161 views

DSolve—different solutions for same set of equations using different symbols?

I happen to find that DSolve can give different solutions, even a different number of solutions, for a set of differential equations just by making a change in the ...
8
votes
1answer
342 views

Find a word's linguistic pronunciation

Is there a way to get a word's linguistic pronunciation given the word as a string? I would like a function LingusticPronunciation such that, for example, ...
4
votes
1answer
171 views

Goal optimization: finding the best combination of capacitors and resistors resulting in given properties

I want to edit @MarcoB answers (because the code he gave doesn't answer the question appropriately)->(the function that need to be optimised is not implemented as asked) But it seems like I am having ...