# Questions tagged [numerics]

Questions on the numerical functions of Mathematica, implementing numerical methods and numerical computing with Mathematica.

1,761 questions
Filter by
Sorted by
Tagged with
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 ...
4answers
42k 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 ...
9answers
6k views

### Updating Wagon's FindAllCrossings2D[] function

Stan Wagon's Mathematica in Action (second edition; I haven't read the third edition and I'm hoping to eventually see it), demonstrates a nifty function called ...
3answers
8k views

### Numerically solving Helmholtz equation in 2D for arbitrary shapes

I would like to solve the Helmholtz equation with Dirichlet boundary conditions in two dimensions for an arbitrary shape (for a qualitative comparison of the eigenstates to periodic orbits in the ...
3answers
3k views

### When can I assume that all decimal digits returned by Mathematica are provably correct?

How to Control the Precision and Accuracy of Numerical Results Arbitrary-Precision Numbers Mathematica works with exact numbers and with two different types of approximate numbers: machine-...
11answers
6k views

### Can Mathematica propose an exact value based on an approximate one?

Sometimes, I use Mathematica to do some hypothesis on homework to make the question easier. For instance, when I have to compute big sums when $n\to\infty$ and Mathematica can't give the exact answer, ...
1answer
3k views

### Adaptive sampling for slow to compute functions in 2D

EDIT: Although I have posted an answer based on my current progress, this in incomplete. Please see the "open issues" section in the answer. Most plotting functions in Mathematica adjust the ...
3answers
3k views

### Is manual adjustment of AccuracyGoal and PrecisionGoal useless?

This is a problem confusing me for years. AccuracyGoal and PrecisionGoal are two options that I never truly understand and, to ...
6answers
11k views

### Finding real roots of negative numbers (for example, $\sqrt{-8}$)

Say I want to quickly calculate $\sqrt{-8}$, to which the most obvious solution is $-2$. When I input $\sqrt{-8}$ or Power[-8, 3^-1], Mathematica gives the ...
9answers
11k views

### About multi-root search in Mathematica for transcendental equations

I have some questions for multiroot search for transcendental equations. Is there any clever solution to find all the roots for a transcendental equation in a specific range? Perhaps ...
3answers
3k views

### Funny behaviour when plotting a polynomial of high degree and large coefficients

I am trying to plot a polynomial of degree $29$ on the domain $[0,1]$, with fairly large coefficients: ...
0answers
2k views

### Fast Spherical Harmonics radiative transfer

This is a rather specific question and I apologize for spamming you with some lengthy code. But it could be interesting for some reader and maybe you can help out, so please bear with me. I am using ...
3answers
14k views

### Understanding differences between Maple and Mathematica in examples picked by Maplesoft

I am reading the document How Maple Compares to Mathematica. On page 15 there is an example where Mathematica produces wrong results. Does anybody know why? MAPLE: MATHEMATICA: Also on page 17 the ...
3answers
4k views

### Identifying critical points/lines of 2/3D image/cubes

Upshot I am interested in identifying critical points of a 3D field/cubes (maxima, minima, tube-like and wall-like saddle points) and 2D field/image (maxima, minima, saddle points). I.e. the ...
2answers
2k views

### How to work with ExperimentalNumericalFunction?

This question is intimately connected with previous one: "How to create internally optimized expression for computing with high WorkingPrecision?" Oleksandr R. correctly states in the comment: A ...
1answer
3k views

### How to compare power towers in Mathematica?

First I tried it directly, but it overflowed: ...
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,...
1answer
1k views

### Is there a difference between Divide[a,b] and a/b?

In this comment it was asserted that Divide[a,b] and a/b are different, though the documentation indicates that they are the ...
2answers
6k views

### Efficient Langevin Equation Solver

This question is not about good algorithms for solving stochastic differential equations. It is about how to implement simple codes in Mathematica efficiently exploiting Mathematica's programming ...
1answer
4k views

### AccuracyGoal, PrecisionGoal, WorkingPrecision and NDSolve

I'm trying to understand exactly what WorkingPrecision, AccuracyGoal and PrecisionGoal mean ...
2answers
3k views

### Meaning of backtick in floating-point literal

If I compute, say, 1/3//N, Mathematica displays 0.333333 as the result. When I copy that output to use elsewhere, the paste ...
2answers
1k views

I'm writing a numerical optimization, and I'm having a problem with an expression of the form $$e^{-t} (1+\mathrm{erf}(t))$$ The overall shape of the function looks correct, but when $t$ is small, $... 1answer 1k views ### Numerics with Mathematica From time to time, I would like to use Mathematica purely numerically, e.g., plotting a function which is defined as an integral which cannot be solve analytically or a solution of a differential ... 2answers 2k views ### How to implement custom integration rules for use by NIntegrate? How can NIntegrate be extended with custom implementation of integration rules? This answer of the question "Monte Carlo integration with random numbers generated ... 3answers 9k views ### Global precision setting Coming from Maple I do not understand how the precision for numerical computations in Mathematica is specified. I understand that there are various options to commands such as ... 3answers 2k views ### How to flush machine underflows to zero and prevent conversion to arbitrary precision? I'm working on some pretty intense computation in Mathematica; when my code started running slowly, I tracked the source of the problem to Exp[]. I need to ... 2answers 753 views ### GroupBy twice gives different results Bug introduced in 7.0 or earlier and persisting through 11.1 It took me quite a lot of time to finally trace down to this strange output. I really don't know why. First, I create a list ... 3answers 3k views ### Why is Plus so much slower than Total? Why is Plus so much slower than Total for summing lists? ... 1answer 715 views ### Is MathieuC for moderately large imaginary arguments broken? Bug introduced in 3.0 and persisting through 12.0 (reported as CASE:3208982) I'm trying to plot MathieuC[-3,0.3,I x] for$x\in[0,10]$, and here's what I get even ... 4answers 2k views ### How to use NDSolve to track equilibrium? I am looking for an extension of NDSolve where integration runs until certain variables are settled at an equilibrium. Now I have a working solution in my sleeves ... 2answers 7k views ### How to fit 3 data sets to a model of 4 differential equations? I'm a biologist and a newbie in Mathematica. I want to fit three data sets to a model consisting of four differential equations and 10 parameters. I want to find the parameters best fitting to my ... 5answers 12k views ### How can I differentiate numerically? Mathematica has two ways to integrate: Integrate and NIntegrate. But what about D? ... 2answers 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 ... 3answers 4k views ### Numerical solution of coupled ODEs with boundary conditions I have to solve the following set of ODEs and just can't get good results using Mathematica $$r\frac{d}{dr}\left(\frac{1}{r}\frac{d}{dr}A(r)\right)-\xi^2F(r)^2\left(A(r)-1\right)=0$$ $$\frac{1}{r}\... 8answers 1k views ### Elegant high precision log1p? Sometimes it is hard to understand how numerical expressions are evaluated. I remember reading claims by Wolfram on how smart the Kernel is to evaluate expressions trees numerically by recognizing ... 3answers 2k views ### Computing polynomial eigenvalues in Mathematica MATLAB offers a function polyeig for computing polynomial eigenvalues, which appear, for instance, in quadratic eigenvalue problems (see here for some applications) ... 4answers 3k views ### Can Mathematica Handle Open Intervals? Interval complements? Open Intervals Following up on this question, I was wondering whether Mma can handle open intervals. For example, the union of the intervals,$$1<x<5$$and$$5<x<8$$should not ... 1answer 25k views ### What do the X and Y axis stand for in the Fourier transform domain? In Wolfram Mathematica the function Fourier has the following declaration Fourier[list] And after a list is given to the ... 3answers 1k views ### How to improve performance of BesselJ to the level of GSL? Consider the following code: zs = N /@ Range[0, 12, 10^-5]; AbsoluteTiming[bessels = BesselJ[1, #] & /@ zs;] Length @ zs I've tried to measure only ... 3answers 722 views ### What determines the value of$MaxNumber?

What determines the value of $MaxNumber?$MaxNumber 1.233433712981650*10^323228458 ...
1answer
465 views

### FindMinimum doesn't increase step size when necessary

(Cross-posted on Wolfram Community.) I've spent much time finding a minimal example demonstrating this problem with FindMinimum. Normally one faces this problem ...
2answers
1k views

### Different floating-point numbers equal?

Let's define two different numbers. x = 1. y = 1. + 2^-52 (* equivalently, 1 + \$MachineEpsilon *) Let's make sure they're different with ...
6answers
6k views

### Mathematica vs. MATLAB philosophy [closed]

During a typical (possibly with alcohol mixed) discussion among some academic peers in regards to numeric calculation and general modern use of computers in science and engineering settings, it become ...
2answers
1k views

### Obtain approximate Hessian using FindMinimum

According to the documentation, when FindMinimum is told to use the method "QuasiNewton" on a unconstrained problem, it uses the ...
3answers
966 views

### Exponential fitting - isn't actually a BUG there?

There are many questions on this site about wrong exponential fitting in Mathematica but no one considers this well-known problem as a potential bug. Usually people suggest well-known workarounds ...
4answers
706 views

### How does InternalCompareNumeric work?

In this answer, Oleksandr R. mentioned an undocumented function Internal`CompareNumeric and briefly explained its usage as follows: ...
1answer
2k 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 ...
6answers
4k views

### Annoying display truncation of numerical results

I have a lot of data to inspect. An example of a number in my program is 123.189094 This gets displayed as 123.189 ...
3answers
12k views

### How to solve ODE with boundary at infinity

y''[x] - x y[x] == 0 y == AiryAi, y[∞] == 0 The analytic solution to this ODE is the Airy function y[x] == AiryAi[x] if ...
2answers
3k views

### Optimizing a Numerical Laplace Equation Solver

Laplace's Equation is an equation on a scalar in which, given the value of the scalar on the boundaries (the boundary conditions), one can determine the value of the scalar at any point in the region ...