Questions tagged [numerics]

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

Filter by
Sorted by
Tagged with
9
votes
2answers
421 views

Singularity error. What is actually causing the problem here?

I am solving the equation of motion for a nonlinear oscillator. At values of $\nu$ greater than $\approx 0.408$, this list stop plotting, giving an error like this (for ...
9
votes
3answers
666 views

Derivative of contour in ContourPlot

Sorry to bring this question up again, since there are many similar questions on the site. I use to think this is a easy job to do, because for the worst case I can follow the answers on this site. ...
9
votes
3answers
685 views

Labeling solutions of an Eigenvalue equation involving Bessel functions

I'm solving the Schrödinger equation for a particle in an annular geometry with hard wall boundary conditions and I've reduced it to the following equation: $$J_m(k\,R_1)\,Y_m(k\,R_2) - J_m(k\,R_2)\,...
9
votes
3answers
1k views

Very different results from evaluating same expression with different precisions

When I evalute the following expression, ...
9
votes
4answers
509 views

Mathematica numerical “error” for simple multiplication

...
9
votes
3answers
1k views

How to prevent instability blow up in NDSolve?

I have the following code to solve a PDE: ...
9
votes
2answers
367 views

How to detect underflow/overflow (post 11.3)?

This old trick used to work before 11.3: SetSystemOptions["CheckMachineUnderflow" -> True] But no longer... so how can we explicitly check for this in v12+?? ...
9
votes
1answer
1k views

Boundary sphere partial differential equation

I am trying to solve partial differential equation in spherical coordinates $(\theta,\phi)$,but I don't know how to properly include boundary conditions of $\theta$. For $\phi$ it is periodic, but $\...
9
votes
3answers
250 views

FindRoot evaluates the exact same point multiple times. Why?

This is a follow-up question to this question. Let's say we want to minimize the following function f wrt. x and ...
9
votes
2answers
216 views

Efficient way to obtain values of a function defined by an Integral

Consider the following equation: $$S(q)=\frac{(4 \pi \rho ) \int r (h(r)-1) \sin (q r) \, dr}{q}$$ I want to numerically obtain values for $S(q)$ given that I have data points representing $h(r)$ ...
9
votes
2answers
1k views

How can I numerically solve for fractional functions and fractional derivatives?

I would like to plot fractional functions. Say, $f(x)=\sin^{(1/2)}(x)$. By that, I mean that $f(f(x)) = \sin(x)$. Similarly, I can define a half-derivative to be an operator $H$ such that $H[H[f(x)]]...
9
votes
1answer
8k views

How to Take Derivative of Interpolating Function? [closed]

So I have two numerical differentialequations which yield a InterpolatingFunction each, potentialup and potentialdown. I have ...
9
votes
2answers
719 views

How to locate the position of a periodic orbit

These are the equations of the dynamical system ...
9
votes
1answer
450 views

Finding skewness and kurtosis numerically in Mathematica

I have a function given by ...
9
votes
2answers
559 views

Precision differences

I run this sum and get the symbolic answer below : Sum[ (1/(k^2 - k) - 1/k^2), {k, 2, Infinity}] $2 - \frac{\pi^2}{6}$ I look up the sequence on OEIS and ...
9
votes
3answers
370 views

How to create a version of FixedPointList for asymptotically periodic functions?

I need to efficiently generate a bunch of bifurcation diagrams. A simple familiar example illustrates the efficiency problems I'm running into: ...
9
votes
2answers
583 views

Derivative of the Dedekind eta function fails to compute with errors I don't understand

When trying to understand better the question Eisenstein Series in Mathematica?, I stumbled on the following: issuing Derivative[1][DedekindEta][.11 I] gives ...
9
votes
1answer
295 views

How to handle discontinuity in diffusion coefficient?

I am looking to solve the diffusion equation with a discontinuous jump in the diffusion coefficient. In 1D, the diffusion equation for $u(t,x)$ is: $$ \partial_t u = \partial_x (D \partial_x u), $$ ...
9
votes
1answer
614 views

Machine Epsilon

I'm trying to evaluate the machine epsilon of my computer (see below). I wrote this: ...
9
votes
2answers
805 views

How to apply restrictions to the “integrated” variable, when using NDSolve?

I have to integrate an energy along a path. I know the energy at the "beginning" of the path (energy[0]), and I can determine the energy change (gain and loss) ...
9
votes
1answer
333 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 ...
9
votes
1answer
695 views

Trouble with shooting method for a 4th-order differential equation

I'm trying to solve the following forth-order ODE with the shooting method: $$\frac{1}{5}(y-2xy^\prime)=\frac{1}{x}\left\{\frac{xy^\prime}{y}+xy^3 \left[\frac{(xy^\prime)^\prime}{x} \right]^\prime \...
9
votes
1answer
3k views

How can I invert a Laplace transform numerically?

I have a very complicated expression, which I want to transform using the inverse Laplace transform. The built-in function InverseLaplaceTransform doesn't work. So,...
9
votes
1answer
591 views

Dynamic, nonlinear, damped Euler–Bernoulli beam equation

I would like to solve the 3 coupled PDEs describing a damped, nonlinear (i.e displacements in the $x$ direction along the beam need to be considered along with the $y$ displacements normally ...
9
votes
2answers
411 views

Integrate and NIntegrate disagreeing over branch cut of Sqrt?

Bug introduced after 8.0.4 and before 9.0.1, and fixed in 11.1.0. In Mathematica 10.2 I'm trying to integrate this piecewise continuous function, but Integrate and ...
9
votes
1answer
2k views

NIntegrate receiving a function with NumericQ which returns a list

Can some one please explain why ...
9
votes
2answers
2k views

RootSearch for complex or multiple equations

First the background. I'm trying to solve for the roots of a rather messy complex equation. This is not the exact equation, but it's a decent (simpler) stand in: ...
9
votes
2answers
173 views

Problem with Binomial numerical computation

Using Mathematica 10.4.1.0 I have a problem with Binomial on numerical computations. Both of the following correctly return 1.0 as the result: ...
9
votes
1answer
180 views

Has “faster arbitrary precision computation of elementary functions” been incorporated into Mathematica?

In this Wolfram Conference talk from last year, "Faster Arbitrary Precision Computation of Elementary Functions", they talk about R&D for algorithms to numerically evaluate elementary functions ...
9
votes
1answer
2k views

Implementation of Incomplete Fermi-Dirac Integral in Mathematica

I'm working on a special algorithm to implement a more accurate effective mass calculation for hole carriers in silicon in Mathematica. This rather involved algorithm uses incomplete Fermi-Dirac ...
9
votes
1answer
278 views

Comparing exact expressions for equality — is it really OK if I get wrong answer?

Bug introduced in 7.0 or earlier and fixed in 10.2.0 I found an unexpected behavior (that I think of as a bug) in evaluation of the equality operator applied to mathematical functions with exact ...
9
votes
1answer
120 views

Ordering real numeric quantities

Suppose I want to have a function (call it NLess) that given two real numeric quantities, a and b, it returns True if a is smaller than b, ignoring precision. Here are some test cases: ...
9
votes
0answers
161 views

Dividing by Zero - Unexpected Result [closed]

When I divide this number by zero I get this for an answer. ans = 2345900/0 (* *) What is surprising is that in taking the square root, Mathematica seems to ...
8
votes
7answers
2k views

How to display very small numbers in Mathematica?

I am trying to evaluate the function: $$f(x) = \cos(x) - \mathrm{e}^{-2.7 x}$$ at $x = 1.7 \times 10^{-25}$ and Mathematica keeps returning '0.' How do I evaluate the expression in a better way?
8
votes
5answers
2k views

Numerical voodoo in mathematica? [closed]

So, I was doing some calculations in Mathematica, and came across the following paradox! (I may be exaggerating, but...) I wanted to solve the following equation: $3.33333*10^{-15} - 3.33333*10^{-15} ...
8
votes
3answers
409 views

Finding the Period of a Limit Cycle

I'm interested in the periods of limit cycles of the Wilson-Cowan equations which have the form $$x'(t) = -x + S(ax(t) - by(t) +e)$$ $$y'(t) = -y + S(cx(t) - dy(t) + f)$$ where $$S(x) = 1 + \frac{...
8
votes
2answers
823 views

Finding differences between Pi with varying number of decimals

I have the following code In[32]:= N[Pi, 2] Out[32]= 3.1 In[33]:= N[Pi, 1] Out[33]= 3. In[34]:= N[Pi, 2] - N[Pi, 1] Out[34]= 0.*10^-1 Why can't Mathematica ...
8
votes
2answers
2k views

Integration of a rapidly oscillating function

I have a function F which behaves like you can see on the plot shown below. I need to calculate ...
8
votes
1answer
370 views

Why does taking advantage of Listable change the results of a numerical computation slightly?

I have two variables: t0, and teta0. The first is computed using several nested sums, the second is computed taking advantage to ...
8
votes
3answers
535 views
8
votes
4answers
2k views
8
votes
3answers
5k views

Machine precision near zero: not fulfilled?

I am puzzled by the behavior of Mathematica machine precision with numbers approaching zero. This manifests itself, e.g., with FixedPoint and the like. In the ...
8
votes
4answers
2k views

Transform an InterpolatingFunction

I'd like to transform an InterpolatingFunction from NDSolve but can't figure out how. Here's an example. The equation I want to solve is ...
8
votes
1answer
715 views

Really understanding precision

I've been reading the documentation in Mathematica about precision, namely: Exact and Approximate Results Arbitrary-Precision Numbers Arbitrary-Precision Calculations Machine-Precision Numbers ...
8
votes
4answers
1k views

ListPlot very large numbers

Suppose we have the following function: NN = 150; W[n1_] := NN!/(n1 ! (NN - n1!)) (1/2)^n1 (1/2)^(NN - n1) Then we can Plot ...
8
votes
2answers
166 views

Why does ReliefPlot not have a version for functions?

To plot bivariate functions, we typically either use Plot3D, whose dynamic effects allow flexible investigation, or DensityPlot, ...
8
votes
2answers
272 views

Converting a backward/forward sweep code for optimal control to _Mathematica_

I'm trying to convert to Mathematica a simple backward/forward sweep (with RK4 integrator) code to solve an optimal control problem in epidemiology, but I'm getting some error messages and I cannot ...
8
votes
2answers
401 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 ...
8
votes
2answers
890 views

Is there any fast way to solve a quadratic matrix equation in Mathematica approximately?

Let the square nonsingular matrix $M$ is a given convergent matrix. What are the best scalar values for $\alpha$ and $\beta$ (in the real numbers domain), at which the following quadratic matrix ...
8
votes
1answer
447 views

SetPrecision within Block

I am reading Mathematica Cookbook, chapter 1. Author gives two examples, with the following explanation You can control precision within a complex calculation (without using ...

1
3 4
5
6 7
36