Questions tagged [implementation-details]

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

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 ...
user avatar
  • 225k
59 votes
1 answer
3k views

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

I'm curious what's inside the InterpolationFunction object? For example: ...
user avatar
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 ...
user avatar
  • 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: ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 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: ...
user avatar
  • 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,...
user avatar
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: ...
user avatar
  • 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 ...
user avatar
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 ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
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 ...
user avatar
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: <...
user avatar
  • 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, ...
user avatar
  • 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, ...
user avatar
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} *) ...
user avatar
  • 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, ...
user avatar
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: ...
user avatar
  • 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 ...
user avatar
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  (...
user avatar
  • 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 ...
user avatar
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,...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 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. ...
user avatar
  • 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. ...
user avatar
  • 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]] ...
user avatar
  • 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[{#, #, #}]] &...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
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 ...
user avatar
  • 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 ...
user avatar
  • 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: ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
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 ...
user avatar
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 ...
user avatar
  • 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 *) ...
user avatar
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? ...
user avatar
  • 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 ...
user avatar
  • 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 ...
user avatar
  • 225k