# Tagged Questions

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

973 views

### Is this the most efficient way to round approximate integers to integers while leaving other Reals untouched?

This might seem like an overly simple question, but I need to specify custom plot tick marks as integers (no trailing decimal point) if they are approximately integers, but not if they are not. Using <...
398 views

### What determines the value of $MaxNumber? What determines the value of$MaxNumber? $MaxNumber 1.233433712981650*10^323228458 ... 2answers 308 views ### More efficient method to compute moments of the Johnson$S_B$distribution Here is a very specific feature request. I need Mean[JohnsonDistribution["SB", γ, δ, 0, 1]] When I issue e.g. ... 4answers 642 views ### How to remove duplicates from set of machine precision 2D points? I have a set of 2D points with machine precision coordinates. I need to remove all duplicates. Performance is important. This is the most obvious fast solution: ... 2answers 3k views ### How to discretize a nonlinear PDE fast? I wish to numerically solve the following PDE. Although there are some complete discussions for solving PDEs in tutorial/NDSolvePDE, there is no hint for the nonlinear case by discretization. Thus, I ... 1answer 2k views ### What are the algorithm details of FindRoot? The Help page of FindRoot says: "by default, FindRoot uses Newton's method (Newton-Raphson) to solve a nonlinear system". But I ... 2answers 590 views ### Determining the default Method used in optimization and root-finding algorithms Is it possible to extract the Method which is used in functions like NMinimize, FindRoot, <... 2answers 463 views ### Why is my data 10 times slower than random data when doing matrix multiplication I have some data generated from some program, and it appears that matrix multiplication on these data are about 10 times slower than on some random data: ... 2answers 1k views ### How to compute the inverse CDF of HyperbolicDistribution properly? Fixed in version 9. I want to compute the CDF and inverse CDF of the hyperbolic distribution: ... 1answer 3k views ### Parallelizing Numerical Integration in Mathematica I have an ugly, six dimensional function that I need to integrate numerically. It works, but it currently take twelve hours to complete the calculation. Is there any good way to parallelize the ... 0answers 185 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 ... 4answers 2k views ### Numerical underflow for a scaled error function I calculate scaled error function defined as f[x_] := Erfc[x]*Exp[x^2] but it can not calculate f[30000.]. ... 2answers 205 views ### CompiledFunction returns machine numbers smaller than$MinMachineNumber

When thinking on the workaround for this LogLogPlot bug suggested by halirutan I noticed that CompiledFunction actually can ...
494 views

### Why is MainEvaluate being used when LinearSolve can be compiled?

According to this question LinearSolve can be compiled. However, CompilePrint[] shows a call to ...
2k views

### Poisson solver using Mathematica

I am looking for some help with a Poisson solver I am writing in Mathematica. The code is quite long with Arrays plugged in, so the full details can be found at http://pastebin.com/uSrSDcW6 I am ...
3k views

### Finding a fit to a multi-dimensioned function

I have a model function $f:\mathbb{R}^2\rightarrow\mathbb{R}^2$, and a bunch of data points for which I'd like Mathematica to fit for me. Unfortunately FindFit ...
2k views

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}\... 2answers 466 views ### Why do NumberForm and Round apparently use different tie-breaking methods? When rounding numbers (for example, rounding a real number to the nearest integer), the "round to nearest" rule is usually used. For example, 1.4 is rounded down to 1 and 1.6 is rounded up to 2. ... 0answers 164 views ### FindMinimum doesn't increase step size when necessary I've spent much time finding a minimal example demonstrating this problem with FindMinimum. Normally one faces this problem when fitting very large and complicated ... 3answers 400 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 ... 1answer 612 views ### How to guarantee that NDSolve correctly detects abrupt changes in parameters? When using NDSolve, I often have parameters that, in most of their domain, have a constant or null variation, but that suffer from abrupt variations on a very small ... 3answers 1k views ### Strategies to avoid LessEqual::nord in NMinimize? When using NMinimize on functions with complex intermediate expressions (but a real end result), quite often one gets the error ... 1answer 1k views ### How do I find all the solutions of three simultaneous equations within a given box? Sometimes, one needs to find all the solutions of three simultaneous nonlinear equations in three unknowns$$\begin{align*}f(x,y,z)&=0\\g(x,y,z)&=0\\h(x,y,z)&=0\end{align*}$$within a ... 1answer 3k views ### Computation of Hankel Transform using FFT (Fourier) To address circularly symmetric cases of 2-D Fourier Transformations, the so-called Hankel Transform can be applied (for a detailed derivation of the relation between the 2-D Fourier transform and the ... 1answer 311 views ### Non Standard Eigenfunction Plots of the Laplacian Over the Unit Square I have recently been plotting eigenfunctions of the laplacian over the unit square using the NDEigensystem command. However, I have noticed something in the plots ... 4answers 298 views ### Does Mathematica have an equivalent of C's nextafter? In C (and many other programming languages), there is a function double nextafter(double x, double y) which takes two (IEEE 754) floating-point numbers and ... 2answers 325 views ### What can one do with extremely stiff problem in NDSolve? Consider the following illustrative problem:$$ \frac {\partial f} {\partial t} = \frac {\partial} {\partial x}(x f) + \frac {\partial} {\partial x}(f \frac {\partial f} {\partial x}) $$This is ... 2answers 1k views ### Numerical partial derivative For a one-variable numerical function, it's simple to calculate the derivative at a point with Derivative as Szabolcs has pointed out before: ... 2answers 619 views ### more numerically accurate inverse matrix I encountered the following matrix mat = {{2, 2.161209223472559 + 1.682941969615793 I}, {2.161209223472559 - 1.682941969615793 I, 2}} and ... 1answer 432 views ### What strategies can I use to evaluate a limit when Limit[] returns unevaluated I'm trying to find the following limit using Mathematica:$$\lim_{N\to\infty}\sum_{k=1}^N\left(\frac{k-1}{N}\right)^N$$The problem is taken from here and is known to converge to \displaystyle\frac{... 1answer 2k views ### Combined numerical minimization and maximization I want to numerically calculate the maximum of a function defined by the minimization of another function, like the following: ... 2answers 1k views ### Is it possible to use the LevenbergMarquardt algorithm for fitting a black-box residual function? I have a black-box multiargument multiparametric function of the type SRD[dataPoint_List,params_List] which accepts experimental data along with the parameters of ... 1answer 2k views ### Kramers-Kronig in Mathematica I am trying to calculate the change of the refractive index from the change of the absorption coefficient using the Kramers-Kronig relations, in Mathematica. ... 3answers 4k views ### Does Mathematica get Pi wrong? I happened to watch a Youtube video on Pi. According to the video, the 1 millionth digit of Pi is 1. And here is another page of the first 1 million digits of Pi. You can get the same answer from ... 7answers 741 views ### Numerical evaluation of a sum I am trying to compute numerically NSum[(-1)^n/n^3, {n, 1, Infinity}]. Of course, using first Sum would work here, but often it'... 4answers 672 views ### Why is Poisson Random Deviate Generation so slow? I am generating Poisson deviates for some numerical work. Mathematica 9.0.1 is very slow in generating these random numbers, as can be seen below. ... 3answers 6k views ### NDSolve with Euler method I want to solve this equation with NDSolve[] using the Euler method: x'[t] == 0.5*x[t]-0.04*(x[t])^2 with initial condition ... 2answers 395 views ### Wrong computation with N I was trying to solve this problem using Mathematica 8.04. I did this: ... 1answer 357 views ### Eisenstein Series in Mathematica? Mathematica doesn't seem to have built-in tools to deal with the Eisenstein series:$$\begin{align*} E_{2}(\tau)&= 1-24 \sum_{n=1}^{\infty} \frac{n e^{2 \pi i n \tau}}{1-e^{2 \pi i n \tau}}\\ E_{...
2k views

Finding a global minimum for this problem (non-linear optimization by the Nelder-Mead downhill simplex method) may not be possible, but by finding local minimum, I am expecting the value of the ...
5k views

### How do you force a decimal output? [duplicate]

I have some very small values such as 2.601519253*10^-8. I'd like to output these values to CSV for another program to work with. I've tried N[value, 50], but Mathematica still insists on producing ...
373 views

### Converting to machine precision

There are multiple ways to convert an expression to machine precision, for example: ...
Bug introduced in 8.0.4 or earlier and persists through 10.4. I am trying to evaluate this integral numerically $$\int_0^{\infty } J_0(q R) \tanh(q) \, \mathrm{d}q$$ for large values of $R$. ...