We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [numerics]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
96 views

Testing the accuracy of numerically computed derivatives - alternative method

So I have asked this question earlier today: Testing the accuracy of numerically computed derivatives, This method works well for DifferenceOrder methods but upon reading https://reference.wolfram....
1
vote
2answers
60 views

Testing the accuracy of numerically computed derivatives

I am calculating approximate derivatives by using NDSolve`FiniteDifferenceDerivative, so this works: ...
2
votes
1answer
67 views

More elegant/efficient numerical WKB implementation for 1D Schrödinger Equation

I'm trying to figure out a better way to implement numerical WKB quantization of a spectrum. WKB quantization is the condition that $$\oint_{E}p \, \mathrm{d}q = \pi \hbar (n+1/2)$$ So the idea to ...
0
votes
1answer
57 views

Allow Mathematica to solve the differential equations with larger than 16 digits parameters

Consider the system of differential equations ...
0
votes
0answers
41 views

Numerical maximization

I am facing a numerical maximization problem with constraints. Using Method -> {"RandomSearch", "SearchPoints" -> 3}, AccuracyGoal -> 2 often does not find ...
-2
votes
2answers
109 views

Find the square root using a recursive formula [on hold]

I want to approximate the square root x=Sqrt[a] for $a>0$ using the the formula $x_{n+1}=\frac{1}{2}(x_n+a/x_n)$. How can I do this?
0
votes
1answer
44 views

Power towers Power towers from x to n [on hold]

How can I make Mathematica calculate a power tower for a succession of numbers, but instead of writing them, Mathematica does the iterative calculation. ...
0
votes
0answers
26 views

Constrain values to numeric during Minimize

I understand, that similar questions have been asked before, but I am absolutely new to Mathematica and can not solve it myself: In nuce it is the following: I want to calculate ...
10
votes
2answers
489 views

Morphing between two functions

Assume we have 2 peaked positive functions f[x_] := Exp[-(x + 3)^2] g[x_] := 1/2 Exp[-(x - 3)^2/4] that look like Would it be possible to numerically find a ...
5
votes
3answers
354 views

How to calculate an infinite sum to 100 exact digits with NSum?

In the discussion https://math.stackexchange.com/a/3419778/198592 I stumbled of the question how to calculate the sum $$s= \sum _{n=3}^{\infty } \frac{n \cot \left(\frac{\pi }{n}\right)}{4^{n-2}}$$ ...
5
votes
3answers
229 views

How to evaluate theta function's derivative numerically?

I run into this derivative but Mathematica won't evaluate: ...
6
votes
2answers
193 views

Solving a steady-state viscous Burger's equation with NDSolve

A steady-state viscous Burger's equation is given by $$ u\,u'=\nu \,u'', \quad x\in (-1,1), $$ $$ u(-1)=1+\delta,\quad u(1)=-1.$$ Here $\nu>0$ is the viscosity, $\delta>0$ is a small ...
2
votes
1answer
67 views

Problem with numerical evaluation of a Hankel identity

There an identity with the Hankel functions of both types (https://dlmf.nist.gov/10.11 eq. 10.11.4 or http://apps.nrbook.com/bateman/Vol2.pdf pg. 80 eq. 43): $$ \sin\left(\nu\pi\right){H^{(2)}_{\nu}}\...
15
votes
1answer
189 views

When does NDSolve parallelize ODE system solving?

I've long believed that NDSolve cannot make use of multiple cores to solve ODE system, but things seem to be different at least since v12. Consider the following ...
1
vote
1answer
36 views

ODE solving and NDSolveValue error depending on parameters

Given the two sets of $2N$ equations ...
2
votes
0answers
25 views

What kind of performance should I expect out of Eigensystem using FEAST?

I'm numerically solving a time-independent Schrödinger equation using Eigensystem's FEAST method. It takes a lot longer than I ...
0
votes
1answer
51 views

Abs[]^2 , Conjugate[], ComplexExpand[], and Simplify

I think this is a numeric problem but would like to see where it occurs. I create a complex rational polynomial as follows and make it a function of f ...
0
votes
1answer
49 views

NDSolve for Complex Algebraic-Differential Equation

Let consider the following complex equations: $$ \frac{i x(s)}{2\pi} - \frac{\log(1+ e^{-y(s)}) - \log(1 + e^{y(s)})}{\dot x(s)} $$ which I will cal eq1 and $$ \...
2
votes
1answer
81 views

Efficient way to list zeroes of an oscillating function

From "The First 50 Million Prime Numbers" by Don Zagier: primes are integral roots of$$ 1-\frac{\sin(\frac{\pi\Gamma(s)}s)}{\sin(\frac\pi s)}. $$ The graph of this function looks like I would like to ...
3
votes
2answers
169 views

Strange NSolve failure [duplicate]

...
4
votes
1answer
68 views

“Arnoldi” method for Eigenvalues inside FindRoot

I'm trying to implement a function which, given a matrix with one free parameter, would return the value of the parameter at which the lowest eigenvalue of the matrix is equal to a certain number. ...
0
votes
0answers
31 views

System of delay differential equations: using first interpolation as second initial condition

I am trying to solve numerically the following system of two coupled delay differential equations: $$\dot x(t)=-\gamma x(t)-\frac{\gamma}{4}e^{i\omega_0\tau_1}y(t-\tau_1)\theta(t-\tau_1)+\frac{\...
0
votes
2answers
61 views

How to get Nintegrate of multi-dimensional oscillatory function to converge?

So I have the following integral I wish to compute. The constants required are defined as: ...
2
votes
0answers
42 views

Speeding up the process of NDSolve[] when a user-defined function is involved?

I am trying to tackle a (1+4 dimensional PDE) model at which the solution of the first PDE (with some interpolations and changing the domain) would be used in the second PDE. In fact, I must choose ...
0
votes
1answer
30 views

How to have NonlinearModelFit not evaluate a function too early?

This is a follow up of my previous question How can I define the following function for arbitray values of the arguments? that received no attention so here I will try to be more concise with the ...
1
vote
1answer
72 views

Strange evaluation of Bessel Functions near $x=730$?

I am doing a calculation which involves the numerical evaluation of the following function: $$f(x)=I_0(x)K_0(x)-I_1(x)K_1(x)$$ where $I_{\nu}(x)$ and $K_{\nu}(x)$ are the modified Bessel functions. ...
1
vote
2answers
77 views

How to assign a constant value in a recursion relation

I use the code ...
1
vote
1answer
89 views

RecurrenceTable runs very slowly when doing exact arithmetic [closed]

I am a newbie to Mathematica. I wanted to generate a sequence of numbers with the following command: ...
6
votes
1answer
90 views

Is it possible to make listable Experimental`NumericalFunction?

I have been playing a bit with the undocumented function Experimental`CreateNumericalFunction and I wanted to know if somebody found a way to make generated ...
0
votes
2answers
79 views

Why is FindRoot so slow for this problem Det[M[x]]==0

I'm trying to use Mathematica to find the numerical solution to an equation Det[M[x]] == 0, where M[x] is a matrix function of <...
0
votes
0answers
25 views

Why does the numerical inverse laplace function FT for small times give erroeous results and what is the alternative

I am trying to do the numerical laplace inverse of a very complicated transfer function, subject to a trapezoidal pulse input. For the sake of understanding, I will use a simple transfer function to ...
0
votes
1answer
83 views

FindRoot - Convergence Failure

In my problem which I try to solve with FindRoot in Mathematica version 12 I usually get the following errors ...
1
vote
1answer
32 views

NSolve with Interpolation function

I am trying to apply NSolve to an Interpolation function which I have evaluated before. For a function of 1 argument everything works out but as soon as I try to apply the procedure for a function of ...
4
votes
3answers
414 views

How to set a tolerance level for equality constraints

Given two equality constraints: x+y==250 and z+p==65 where x=190, y=50, z=45, p=15, I want ...
0
votes
0answers
29 views

NIntegrate fails to converge despite using attempting to use different methods

I have the following Green's function that I am trying to evaluate for several different values on a defined mesh. The mesh and Green's function is defined below. The mesh runs from values -w/2 to w/2....
8
votes
1answer
186 views

Solving underdetermined Lyapunov equations?

I'm wondering if there's an efficient way to get a solution (ie, LeastSquaressolution) for Lyapunov equation $AX+XA=C$ with symmetric positive definite $ A $ and $ ...
1
vote
1answer
73 views

Numerical solution to Differential equation

I want to get the differential solution numerically. I used wolfram alpha. here is the link. I tried this code on the Mathematica file. ...
0
votes
1answer
50 views

How can I define the following function for arbitray values of the arguments?

Consider the following function a[m_, l_] = 1/Log[m/l]; with this function I define ...
6
votes
2answers
789 views

Integration of Interpolated function take an unacceptable amount of time

I have a simple integration which, when using an interpolation function, is taking too long to calculate: ...
2
votes
1answer
73 views

Product from max to min [closed]

Product[f[i], {i, 1, 4}] gives us f[1] f[2] f[3] f[4] Is there any way I can take the product it will give something ...
3
votes
1answer
101 views

Solving a stiff nonlinear ODE system

The system I am trying to solve is simple, but looks pretty stiff and I have unsuccessfully tried to solve it with StiffnessSwitching. It is the following one: <...
2
votes
1answer
78 views

Evaluating the Poincaré section for Hénon-Heiles potential through Hénon Method

I must find a poincaré section of a Hénon-Heiles system as described in Hénon-Heiles 1964 paper. The Hénon-Heiles Hamiltonian is the following, $$ H = \frac{1}{2}(p_{1}^{2}+p_{2}^{2}+q_{1}^{2}+q_{2}^{...
2
votes
1answer
134 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 *) ...
1
vote
0answers
37 views

What is used for the % symbol in mathematica? [duplicate]

Im new in mathematica i want to know logic about this program. I got this code: {{vo, vn, Ii}} = {vo, vn, Ii} /. %; i know that the syntax /. is for replacement but i dont know whats going on with ...
9
votes
1answer
288 views

Why ArcTan[1, 0. I ] yields -1.5708+0. I?

Bug introduced in 5.2 or earlier and persisting through 12.0.0 Why ArcTan[1, 0. I ] yields -1.5708+0. I ? The result should ...
16
votes
2answers
309 views

Improving Performance of an XY Monte Carlo

I normally write my Monte Carlo codes in Fortran for speed, but I was doing some quick and dirty work and wrote one in Mathematica for the XY model on a square lattice (see Kosterlitz-Thouless ...
1
vote
1answer
21 views

Numerical Maximization with Alternating Sum

I need to maximize a function that involves an alternating sum and a set of constraints. I have tried the following code: NMaximize[{(-1)^{m}*n!, n + m == 7, m > 0, n > 0}, {m, n}] However, the ...
2
votes
2answers
145 views

Why is Mathematica's default precision only 16 digits? [closed]

I was performing some basic computations when I noticed that NumberForm[N[Zeta[3]], {100, 100}] yields ...
1
vote
1answer
71 views

Inversion of a hypergeometric function

I have been trying to invert the hypergeometric function $$\rho(r)=\frac{2b}{1-q}\sqrt{1-\left(\frac br\right)^{1-q}}\,_2F_1\left(\frac{1}{2},1-\frac{1}{q-1};\frac{3}{2};1-\left(\frac br\right)^{1-q}\...
1
vote
1answer
83 views

How is the best way to integrate using loops

I'm using Mathematica, and I want to integrate a function f[wr] in wr using some method that works with a Table/Do/For in the variable wr. I tried to use something like the Riemann's sum, to evaluate ...