Questions tagged [language-design]

for questions about the design of the Mathematica language itself

Filter by
Sorted by
Tagged with
115
votes
1answer
2k views

Why are numeric division and subtraction not handled better in Mathematica?

There is something that has been troubling me for a while. At least through version 10.0 the performance of a / b and a - b is ...
82
votes
4answers
39k views

Why round to even integers?

According to the Mathematica help: Round rounds numbers of the form x.5 toward the nearest even integer. For example: Round[{0.5, 1.5, 2.5, 3.5, 4.5}] gives ...
47
votes
1answer
5k views

++ is dangerous for C programmers

I noticed this fact, that may be misleading for programmers used to C language. In Mathematica, if you have a function f[] and an array ...
45
votes
1answer
968 views

Is FullGraphics an abandoned function? Is there an alternative?

FullGraphics hasn't worked entirely for a long time and the situation appears to be getting worse instead of better. In Mathematica 10.0, 10.1 up to 11.3 a simple ...
43
votes
5answers
1k views

Why is there no PositionFunction in Mathematica?

Too often I have seen the programs of inexperienced users greatly slowed by using Position in an iterative fashion, when far faster would have been to compute a ...
42
votes
2answers
2k views

What are all the “magic” Symbols in the Mathematica language?

Leonid Shifrin once wrote (excerpted): (Unevaluated) is one of a very few "magic symbols", along with Sequence and <...
39
votes
1answer
2k views

How can I define a new symbolic constant like Pi?

There are a few builtin symbolic constants which behave like numbers, e.g. E, Pi, EulerGamma,...
36
votes
0answers
884 views

Performance problems in new Sequence functions

The new-in-10.1 Sequence* family of functions should provide newly optimized methods for handling sequence problems. Happily in some cases they do! For example ...
32
votes
2answers
6k views

Why do Mathematica list indices start at 1? [closed]

In most programming languages, container indices start at 0. This is not random or hardware-related; for example Dijkstra's article explains why zero-based indices make sense. What are the reasons ...
32
votes
1answer
583 views

The paradigm behind Dynamic and related functionality

Dynamic and the related functionality strikes me as a very unique way to build quick and dirty personal GUIs which are great for experimentation. I suspect that ...
29
votes
1answer
974 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: ...
27
votes
2answers
2k views

Why did the Mathematica Language choose term rewriting instead of the Lambda Calculus as its basis?

Now we can see that Church was associated with the Simply Typed Lambda Calculus. Indeed, it seems he explained the Simply Typed Lambda Calculus in order to reduce misunderstanding about the Lambda ...
26
votes
3answers
1k views

Resolving my Entity* Crisis

In the Wolfram Language I can usually guess a function's name, operation or idiomatic application but I don't have such a sense for various Entities ... ... instead, I seem to keep needing to consult ...
26
votes
2answers
526 views

Version inconsistency with optional arguments: what if the default value doesn't match the pattern?

I just came across some weird behaviour. Take this function definition: ClearAll[f] f[vs_List : All] := "match" The default value of ...
24
votes
2answers
560 views

Why doesn't a Composition[] hold its arguments and what can be done about it?

Now that Composition (also RightComposition) has shorthand syntax I am more inclined to use it, however what I feel should be ...
23
votes
1answer
557 views

What's the point of ContainsAll, ContainsAny and friends?

Mathematica 10.2 contains a few new functions that test set containment: ContainsAll, ContainsAny and a few others. The ...
21
votes
1answer
273 views

Series vs Asymptotic in 12.1

The functionality of Series and Asymptotic (new in V12.1) is very similar. In fact, they are both listed in the Asymptotics ...
20
votes
4answers
980 views

Is expression in Mathematica well defined?

According to Mathematica, everything is an expression. So an atom is also an expression. But in other parts of documentation, they say that an expression is of form ...
20
votes
2answers
444 views

Second argument of BeginPackage with nested package loading

I naively thought that the second argument of BeginPackage can simply be used to ensure the loading and availability in the ...
20
votes
1answer
369 views

Why are some option values symbols, other strings?

Is there a rationale, beyond historical accident, why some Mathematica option values are strings, while others are symbols? It seems natural that some value spaces, e.g. named color schemes, are so ...
20
votes
1answer
278 views

Integrate - Why is the integration variable not local

I have noticed something odd: Let f[t_]:=Integrate[x, {x, 0, t}] h[t_]:=Sum[x, {x, 0, t}] Now, enter ...
19
votes
2answers
344 views

Unexpected behaviour when pattern matching with Longest

I came across some unexpected behaviour today when using the Longest function when trying to do some pattern matching. ...
19
votes
1answer
529 views

Are there advantages to using additional arguments of common functions rather than alternative ways of calculating with lists?

(Apologies for the long question title.) One of the interesting, if sometimes confusing, things about Mathematica is that there is always more than one way to do things. Even intermediate users can ...
19
votes
1answer
663 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: ...
19
votes
1answer
159 views

Why does OperatorApplied by default reverse the arguments?

Perhaps this is just one of those Mathematica curiosities, but I'd like to know why by default OperatorApplied[f][x][y] === f[y,x] versus the more usual way one ...
18
votes
3answers
3k views

Why does Mathematica use [[ ]] notation for array indexing?

I am confused by why Mathematica uses [[3]] to get the 3rd element, or [[i,j] to get the i,j-th element of a 2D array. This ...
18
votes
2answers
242 views

Is mathematica adequately improving?

A bit of a loaded question, but in your opinion is Wolfram's team making good progress on improving their software? I've used Mathematica for almost 10 years now, and honestly I'm personally ...
18
votes
1answer
476 views

What are the benefits of Entity Classes for Databases?

To me, using the older database functionality is much simpler: ...
18
votes
2answers
315 views

Association's Attributes change between 10.3.1 & 10.4?

In Mathematica 10.3.1 In[1]:= Attributes[Association] Out[1]= {Protected} In Mathematica 10.4: ...
16
votes
2answers
1k views

Why it seems that there is no counterpart function as to multiplication, to `Total` as to addition?

Times and Plus have the same grammar, and so do Product and ...
16
votes
3answers
2k views

Specifying string patterns in DeleteCases

It seems that DeleteCases is not compatible with string patterns, at least directly (see, for example, this question). Is this true? If so, why is this the case? ...
16
votes
3answers
336 views

Why is the first argument of the SetDelayed evaluated?

In[1]: f=g; In[2]: SetDelayed[f[x_],x^2]; In[3]: ?f Global`f f=g In[4]: ?g Global`g g[x_]:=x^2 However, SetDelayed has the ...
16
votes
1answer
517 views

Why doesn't Mathematica pack Boolean arrays?

I've been wondering about this for a while now, so I'm going to ask. This is a question about the design of Mathematica, which perhaps cannot be directly answered by anyone but the designers, however ...
16
votes
0answers
189 views

Why are delayed definitions in scoping functions NOT documented?

As outlined here, := may be used in scoping constructs like With to give delayed definitions, but this is undocumented. This ...
15
votes
8answers
1k views

Product of elements of a list

Sum is for functions; Total is for a list. Product is for a function; what is the command ...
15
votes
2answers
4k views

Why does Mathematica order polynomial forms in reverse from traditional order?

I could very well be missing something obvious, but this has always bugged me with Mathematica and I don't know why it does it or how to fix it. If I enter any polynomial, say, x^2 + x - 1 for ...
14
votes
3answers
4k views

Why don't * and ^ work as I expected on matrices? [closed]

For example, this input... {{1, 2}, {3, 4}}*{{1, 2}, {3, 4}} produces this output... {{1, 4}, {9, 16}} and this input... <...
14
votes
4answers
367 views

Association's Key[key] extraction different in V10.1/V10.2

V10.1: <|a -> 1|>[Key @ a] (* Missing["KeyAbsent", Key[a]]*) V10.0: <|a -> 1|>[Key @ a] (* 1 *) Bug or ...
14
votes
2answers
250 views

Is anonymous pure function a scoping construct?

In recent thread was raised the question: why anonymous pure functions Function[body] (or body &) do not rename symbols in ...
13
votes
1answer
279 views

Why can AppendTo modify a referenced list in-place but Part cannot?

Part, AppendTo, PrependTo, AddTo, etc. allow in-place modification of a list, but only Part requires that the list be referenced through a simple symbol, e.g. the following all does what you'ld expect:...
13
votes
1answer
367 views

Is there a good reason for the removal of this FrameTicks syntax?

In past versions of Mathematica one could use a terse syntax for FrameTicks: {bottom, left, top, right} In 10.1 this syntax is no longer recognized requiring the ...
13
votes
1answer
250 views

Code indenting of // postfix functions

Preamble Following the recommendation of a presentation or article which I now only vaguely remember I have been experimenting with a particular code format: ...
13
votes
1answer
306 views

Is Quantity necessary?

Soft question: are Quantity - and newly added MixedUnit and MixedMagnitude - needed in a ...
13
votes
0answers
110 views

Why does MapAt unpack individual elements?

(In case this is version specific I am using Mathematica 10.1 under Windows.) While responding to Partition array without unpacking I noticed something about MapAt ...
13
votes
0answers
504 views

Is there research about the Mathematica programming paradigm?

There seem to be lots of papers discussing the functional programming paradigm terminology for Haskell, such as monad, category theory, lambda calculus, *morphism, etc. People study concepts and ...
12
votes
2answers
783 views

Why aren't parentheses ( ) an expression in Mathematica?

Why aren't parentheses ( ) an expression in Mathematica? Can I get an expression in a form where parentheses are represented by an expression?
12
votes
2answers
262 views

Why are there a lot of input forms in Mathematica?

I'm a novice in using Mathematica. Please can you explain why there are a lot of input forms in Mathematica such as standard, prefix, postfix and infix?
12
votes
1answer
510 views

Why is an empty list not tested by VectorQ?

I am a bit amazed by this behavior of VectorQ[ expr, test ]: VectorQ[ {}, NumberQ ] True It seems that the test itself is ...
12
votes
1answer
482 views

What naming conventions are used for functions? [closed]

I thought there were patterns to how functions were named, but after looking carefully it seems I can always find exceptions. For instance FindThreshold = Action + Object SetAlphaChannel = Action + ...
12
votes
2answers
238 views

ToExpression and ToBoxes aren't inverses of each other?

Applying ToExpression and ToBoxes repeatedly to Hold[1/1] gives many ...