# Questions tagged [implementation-details]

For questions regarding the underlying implementation of built-in functions.

118 questions
Filter by
Sorted by
Tagged with
120 votes
7 answers
7k views

### What is the most convenient way to read definitions of in-memory symbols when we don't have the source files? (Spelunking tools)

Note: I put Simon's implementation on GitHub. Contributions welcome! When trying to read the definition of already defined (package or built-in) symbols using ...
• 225k
59 votes
1 answer
3k views

### What's inside InterpolatingFunction[{{1., 4.}}, <>]?

I'm curious what's inside the InterpolationFunction object? For example: ...
• 26.9k
29 votes
2 answers
1k views

### Where can I get detailed information on how the Plot command works?

The command Plot[x^2, {x, -3, 3}, PlotStyle -> Arrowheads[{-.025, .025}]] /.Line -> Arrow produces this output. What I don't understand is what ...
• 1,195
18 votes
2 answers
1k views

### What boundary is added when boundary condition is not sufficient?

When insufficient boundary conditions are given to NDSolve for solving PDE, usually the warning NDSolve::bcart pops up: ...
• 52.9k
59 votes
3 answers
8k views

### How to find out which method Mathematica selected?

There are commands like NonlinearModelFit[] or NDSolve[] that have the option Method it ...
• 1,305
17 votes
2 answers
4k views

### What's behind Method -> {"EquationSimplification" -> "Residual"}

In order to solve a quite large system of differential equations, I have the habit to use the NDSolve command without changing any options. As I wanted more ...
• 890
13 votes
2 answers
1k views

### How to interpret the FullForm of a SparseArray?

SparseArrays are atomic objects, but they do have a FullForm which reveals information about them. What is the meaning of the ...
• 225k
33 votes
2 answers
2k views

### How does Plot work?

I considered the following function: sin[x_] := Module[{}, Print["x=", x]; Sin[x] ] in Mathematica. Next, I tried to plot it using: ...
• 1,821
53 votes
3 answers
2k views

### How is pattern specificity decided?

Mathematica has a notion of pattern specificity, which is a partial ordering on patterns. The rules (e.g. DownValues, SubValues,...
• 1,211
22 votes
2 answers
1k views

### NDSolve uses different difference order for different spatial derivative when solving PDE

I found something this tutorial for method of line doesn't tell us. Consider the following toy example: ...
• 52.9k
32 votes
2 answers
1k views

### Symbolic derivatives are being calculated numerically

Update: (1) By V11, not sure of the exact version, the derivative IntegerPart' has been given a symbolic definition. (2) The numeric derivative computed has changed ...
• 114k
20 votes
1 answer
5k views

### How does Mathematica integrate?

Basically, this question can be considered to be an extenstion to my other question. What I wanted to do was this integral as homework (it is indefinite BTW so no approximations using Simpson's Rule ...
• 1,079
33 votes
3 answers
2k views

### Is there a "precedence table" for the canonical Sort ordering?

This answer in which I wrote about the Operator Precedence Table was unexpectedly popular. That got me thinking about similar things, and I am wondering: Does an "ordering table" exist for the ...
• 264k
14 votes
2 answers
708 views

### How does FunctionDomain work?

FunctionDomain[(x^2-x-2)/(x^2+x-6),x] gives x < -3 || -3 < x < 2 || x > 2. However, when I factor the ...
• 1,241
33 votes
1 answer
1k views

### How are MemberQ and FreeQ so fast?

I would like to understand the implementation that allows MemberQ and FreeQ to be as fast as they are. I noticed this thanks to ...
• 264k
25 votes
1 answer
658 views

### Why does list assignment with a packed array result in unpacked values?

Bug introduced in 5.2 or earlier and fixed in 10.1.0 This is another question on the design choices in Mathematica. I understand that without direct reply from the developers it may not be possible ...
• 264k
14 votes
1 answer
7k views

### Methods for NonlinearModelFit

I am using NonlinearModelFit for a thesis project. I get quite different results if I change the Method to LevenbergMarquardt or QuasiNewton or ConjugateGradient ...
• 1,163
16 votes
3 answers
479 views

### Evaluated vs. unevaluated Association

This question might have a remote connection to my older question, it is also about sameness of expressions and subtle differences observable only in certain forms. I encountered this strange ...
• 6,866
7 votes
2 answers
3k views

### Methods for NSolve

I've been using NSolve a moderate (50-100 equations) size system of linear equations and it has been working splendidly (Solve ...
• 411
22 votes
2 answers
2k views

### Blend code for built-in ColorData schemes

Hi I want to get a blend similar to "SunsetColors". To make those slight modifications, I would like to know the precise blend of that color scheme. My try: <...
• 589
17 votes
3 answers
552 views

### What is the real default CellEvaluationFunction?

The default CellEvaluationFunction is Identity but one can quickly see that this is handled specially as an equivalent function, ...
• 264k
22 votes
4 answers
1k views

### What is the definition of Curl in Mathematica?

I have a usual mathematical background in vector and tensor calculus. I was trying to use the differential operators of Mathematica, namely Grad, ...
• 1,647
1 vote
2 answers
223 views

### NIntegrate evaluates its 1st argument while it has the attribute HoldAll?

NIntegrate owns the attribute HoldAll: Attributes@NIntegrate (* {HoldAll, Protected} *) ...
• 52.9k
20 votes
2 answers
2k views

### How does Mathematica determine that an evaluation should be terminated?

How exactly does Mathematica determine that evaluation of particular expression should be finished and the result should be returned? Here are some examples of unclear behavior which have arisen, ...
• 56.6k
21 votes
3 answers
6k views

### What's the default colormap (or color scheme) used in mathematica?

For example, the colors used on this page: http://reference.wolfram.com/language/ref/ContourStyle.html or here: https://www.wolfram.com/mathematica/new-in-10/plot-themes/default.html or here: ...
• 313
17 votes
1 answer
4k views

### The difference between "SymbolicProcessing" -> 0 and restricting the function definition to numeric values only

The Documentation tells us that there are two ways to disable symbolic processing of the integrand by the NIntegrate function when it is known that it just slows ...
• 56.6k
16 votes
1 answer
315 views

### How does Plus work on machine precision Real arguments?

I thought Kahan's summation method would make a nice example for students to use to think about round-off error [W. Kahan, Pracniques: Further Remarks on Reducing Truncation Errors, Commun. ACM 8  (...
• 217k
25 votes
1 answer
3k views

### How to determine BLAS/LAPACK implementation used internally for numerical matrix operations?

Is there a command which reveals which implementation of BLAS and LAPACK are used in Mathematica's matrix operations such as Eigensystem? I asked a related question ...
• 11.7k
6 votes
1 answer
681 views

### The default ColorFunction of DensityPlot before v10?

The default ColorFunction of Plot, Plot3D before v10 is respectively mentioned here and here,...
• 52.9k
16 votes
1 answer
809 views

### What is the default ColorFunction for Image3D?

What is the default ColorFunction for Image3D? I find it a bit confusing that the most intense colour is not shown where the ...
• 225k
6 votes
0 answers
248 views

### Does DegreeGraphDistribution sample uniformly?

Bug introduced in 10.0 or earlier and persisting through 12.1 The first symptom (histogram below) is gone in 12.0. The second (fraction of connected graphs) persists, showing that the sampling is ...
• 225k
7 votes
3 answers
804 views

### how to take ImageFeatures?

I want to know how to transform images to feature vector. There is a function FeatureExtractor.And it has some methods. ...
• 429
4 votes
3 answers
230 views

### Pick bug? level 0 matching

A previous discussion of this issue (Is there a bug in Pick?) accepted that matching at level 0 is not a bug in Pick. Was that correct? I am not yet persuaded. ...
• 12.4k
12 votes
2 answers
216 views

### Why NIntegrate is badly-behaved on $J_{\frac{9}{2}}(x)$ by default?

A friend of mine showed me this example: Plot[BesselJ[9/2, x], {x, 0, 1}, PlotLabel -> Style["The integrand seems to be simple", 14]] ...
• 52.9k
7 votes
2 answers
811 views

### What is the default ColorFunction for MatrixPlot?

I think the the default ColorFunction for ArrayPlot is ColorNegate[RGBColor[{#, #, #}]] &...
• 849
42 votes
2 answers
7k views

### How does Interpolation really work?

I'm looking for some explanation or advice, not help in solving something. Recently I finished my program and my supervisor said "Ok, now it's time for your first paper: write a scientific text about ...
• 561
25 votes
2 answers
665 views

### How to implement FittedModel like objects

In the course of making some RLink wrappers I want to have some richer containers like Mathematica does with its FittedModel ...
• 2,195
23 votes
1 answer
656 views

### Underlying Algorithms for List Manipulation Functions

Does anyone know, or know of a link for the underlying algorithms used for list manipulation functions? Specifically: Union with and without the ...
• 1,179
28 votes
1 answer
617 views

### Why Except is so slow as compared to equivalent RegularExpression?

When comparing performance of the solutions suggested for this question I discovered that StringExpression involving Except is ...
• 56.6k
24 votes
2 answers
528 views

### What can be inlined by "InlineExternalDefinitions" -> True?

This not-well-documented option of Compile has been used quite a bit in this site, and based on these examples, I used to think ...
• 52.9k
21 votes
2 answers
2k views

### How to know the internal algorithms of functions like Predict or Classify?

The document centre seems only explain how to use these functions, but just in an very brief way. I know Mathmatica is not open source, so we can not expect to see the code of the function, but are ...
• 1,552
14 votes
1 answer
2k views

### How does Mma compute Confidence Intervals?

I am trying to understand how Mma computes the Confidence Intervals after a NonlinearModelFit. Consider the following example: ...
• 2,118
12 votes
1 answer
577 views

### How does Mathematica calculate $\sin(\pi/5)$?

Consider: Sin[Pi/5] which returns: $$\sqrt{\frac58-\frac{\sqrt5}{8}}$$ Does anyone know how to figure out the trigonometric identities used by Mathematica to ...
• 14.5k
8 votes
1 answer
2k views

### What algorithms does NSolve use?

I've been using NSolve to find roots, and now I've been wondering what underlying algorithm Mathematica uses. It's probably similar to ...
5 votes
1 answer
582 views

### Finding NDSolve method details

I have eqs about the NDSolve, I know this code given the solving automatically. How can I find out what method is used behind the scenes? How can I gauge the ...
• 105
13 votes
1 answer
1k views

### Possible Method for MatrixExp

Well, probably a hard question, but I think it's better to cry out loud :). I noticed that MatrixExp has a Method option when ...
• 52.9k
2 votes
1 answer
230 views

### Is NumberForm double rounding numbers?

A number like 0.644696875 is represented internally as 0.6446968749999...: N[FromDigits[RealDigits[0.644696875, 2], 2], \$MachinePrecision] (* 0.6446968749999999 *) ...
• 7,428
2 votes
0 answers
148 views

### What are the limits of the Prime-functions? [duplicate]

Will Prime and PrimePi test up to 3 * 10^12? Where can I find the limits for these funtions? ...
• 7,769
37 votes
3 answers
2k views

### What is behind experimental function: FindFormula?

In version 10.2 there is a new experimental function: FindFormula[]. I suspect that a genetic programming algorithm (symbolic regression) is behind this new ...
• 1,595
29 votes
3 answers
576 views

### Efficiently appending points to a NearestFunction

I have a program which works with a list of points (in 3D, but it could be in 1D as well, it won't make a difference). Within a loop, it keeps adding new points to the list. To calculate the ...
• 225k