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

learn more… | top users | synonyms (1)

0
votes
0answers
43 views

Union sorting after ignoring some digits

I have a list with its bellow elements: {-0.7071067811865476, -0.7071067811865475, 0.7071067811865475, 0.7071067811865476} If I use Union, but there is no change. Because the numbers are different. ...
17
votes
1answer
238 views

Faster binary Hamming weight for big integers?

While working on an answer to Count the sequences in an array I found that DigitCount was the bottleneck in my code when used as ...
5
votes
3answers
134 views

Finding the conditions for degenerate solutions to a cubic equation

I have a cubic equation (corresponding to the band structure of a physical system) given by w in the code below. ...
1
vote
0answers
54 views

Improve speed of evaluating a sum over four indices

I am trying to implement the Fox-H function with several variables as sum of residues. I have arrived at the following function; ...
0
votes
1answer
42 views

NDsolve with discontinuous non-numeric PDE coefficients

I want to solve the heat diffusion equation with variable thermal conductivity. So I have the following code ...
9
votes
1answer
174 views
0
votes
0answers
22 views

Why does `NSolve` not solve this system of equations on a bounded domain?

I have three functions $E1,E2,E3$ of $t1$ and $t2$. The expressions are slightly complicated and involve trigonometric functions. For clarity purpose, they are given at the end of the question. I ...
9
votes
2answers
84 views

Finding self-intersections of a closed curve represented by an interpolation function

I've been trying to find particular simple closed curves on a plane. ...
5
votes
1answer
57 views

Can Someone Please Explain Internal`$SameQTolerance?

If I input Internal`$SameQTolerance (* output = 0.30103 *) which is the approximation of Log[10,2], or ...
2
votes
2answers
131 views

Steady State Numerical Solution of Heat Diffusion Equation in 2D

I'v been trying to solve for the steady state of the heat diffusion equation numerically but I cant seem to get it to work. My code is ...
2
votes
0answers
48 views

Problem with plotting a function that calls FindRoot

I am having difficulties in plotting the solution of FindRoot to solve 4 variables. I defined a function and then tried tp plot it, but got an error message ...
0
votes
0answers
33 views

Why is there a different eigenvector for the same matrix? [duplicate]

I have a matrix that depends on two variables x and y. Matrix[x,y] When I make x=-.25*(1 - 1/3) + .25*(1/3) + .25 y=0 I ...
0
votes
0answers
16 views

Increasing the zero threshold [duplicate]

I have a function similar to this: func[x_]:=Log[1+x] when I evaluate it at very small arguments, it will become 0, i.e. ...
0
votes
1answer
33 views

Is there a package that can calculate the Ricci tensor from a numerically given metric?

There are many packages about general relativity or differential geometry, and they can calculate the Ricci tensor from a symbolically given metric, for example, $g_{tt}=-f(r)$, $g_{rr}=h(r)$, etc. ...
3
votes
0answers
39 views

Nonuniform Savitzky-Golay filter for smoothing and differentiation

The classical Savitzky-Golay filter works only with uniformly sampled data and currently we have at least two good implementations of it for Mathematica published on our site. But in many practical ...
3
votes
0answers
73 views

Stability analysis of transcendental equation (stability crossing curves)

I am working with a non-linear delay system with three scalar delays. After taking the Laplace transform of the linearized system, the characteristic function is a transcendental equation with three ...
2
votes
2answers
86 views

Calculate area between two multivalued curves

I have to calculate the area between two curves which will give me the result of a particular quantity. However, both the curves are multivalued functions. Here is a data set showing the region where ...
6
votes
1answer
125 views

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

I found an unexpected behavior (that I think of as a bug) in evaluation of the equality operator applied to mathematical functions with exact arguments (i.e. not containing any approximate ...
0
votes
0answers
56 views

Solving a Transcendental Function of two variables numerically

I have a transcendental function F of two variables, i.e. F(x,y). The function F contains ...
16
votes
2answers
288 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 computation ...
1
vote
1answer
115 views

Precision while calculating Fourier transform

I'm trying to understand how precision works in Mathematica. Particularly I'm calculating discrete Fourier transform using the Fourier function and calculating it ...
1
vote
1answer
44 views

Multiplying two parametric solutions

I'm solving two (1-parameter) differential equations and I want to plot the product of their solutions, how do I do this? Here's the code, ...
4
votes
0answers
94 views

Synchrotron Radiation and ListDensityPlot

I'm trying to reproduce this plots: For this task i'm following this blog entry: Synchrotron radiation As you can see there, the task is to make a DensityPlot of a vector field essentially. This ...
9
votes
1answer
162 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 ...
1
vote
0answers
79 views

How to incorporate the boundary conditions into the differentiation scheme in MMA?

Let that we want to numerically solve the following PDE \begin{equation}\label{sde} -r V(S,t)+r S \frac{\partial V(S,t)}{\partial S}+0.5 S^2 \text{sigma}^2 \frac{\partial ^2V(S,t)}{\partial ...
0
votes
0answers
44 views

CharacteristicPolynomial returns 0

I have the following matrix. ...
0
votes
0answers
48 views

Solve an integral equation: to fit the given data with an integral of two functions?

I am trying to find an efficient way to solve the following equation $$h\left(b\right)=\int_{0}^{b}f\left(\frac{b-c}{1-c}\right)\frac{g\left(c\right)}{1-c}dc$$ where for $h(b)$ I have the data ...
1
vote
2answers
82 views

Plot ParametricNDSolve

I am trying to plot the probability of a molecule being in a certain state via the numerical solution of the Schrödinger's equation of molecule in an oscillating electric field (in a rotating system). ...
1
vote
1answer
80 views

Is it possible to solve a certain set of nonlinear equations in Mathematica?

I read this question in a Chinese forum last year. At the end of the discussion, they provide a solution of the equations from a C++ program. Unfortunately, they did not get the right answer. ...
0
votes
1answer
88 views

NDSolve issue with initial and boundary conditions

While solving the heat equation in one spatial variable $u_t = u_{xx} $ (x goes from 0 to L) with the initial temperature distribution $T_0 \frac{x(L-x)}{L^2}$ , and with neumann boundary conditions ...
0
votes
0answers
42 views

Finding common roots to several functions

I am trying to solve the following problem. Given $a\in\mathbb R^n$, $u\in\mathbb{R}^n$, $m\in\mathbb{N}^\star$, Find the/some common roots $(t_1,...,t_m)$ of the $\frac{m(m-1)}{2}$ ...
0
votes
1answer
52 views

NDSolve::bcsol?

I'm writing a code to numerically solve a differential equation. It has to repeat the process several times since there is a variable involved which is unknown, and the equation is fit to some ...
0
votes
1answer
62 views

Problem with Erf near Infinity in NSolve

I have to solve a differential equation involving the error function Erf, but my code is not able to evaluate it in the range I need. I think I can formulate my ...
0
votes
0answers
56 views

BVP Non Linear Shooting Method Implementation

I've been working on this problem for several days. I want to split a 2nd order ode bvp into two auxillary ivps and use those to approximate the solution to the bvp. I have managed to get one ...
16
votes
0answers
192 views

Is MathieuC for moderately large imaginary arguments broken?

I'm trying to plot MathieuC[-3,0.3,I x] for $x\in[0,10]$, and here's what I get even with arbitrary precision arithmetic (here I use ...
1
vote
1answer
138 views

Why does it matter at what point I replace?

I need to find four orthogonal linear combinations of complicated functions, that vanish at four different points. I use (LK4 is defined below, but its shape should have nothing to do with my ...
6
votes
0answers
60 views

Negative accuracy numerics ( 0``-128 notation )

What does it mean to have a negative accuracy number? I understand 0``128 to mean "the number zero to 128 decimal points". Mathematica corroborates this: ...
2
votes
0answers
113 views

Problem solving a nonlinear partial differential diffusion equation [closed]

EDIT: actualy the nonlinear partial differential equations for interacting density distributions, including boundary conditions, should be given as $$ \frac{\partial\phi}{\partial t} = D ...
5
votes
2answers
113 views

A problem with Compile and Map

There is a weird behavior of Compile that I do not understand. Consider the following example: ...
10
votes
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 ...
0
votes
1answer
65 views

usage of random numbers in recursive loop

I am trying to evalute two functions using iterative process as below ...
2
votes
0answers
54 views

How to speed up solution of system of recurrence equations

I was wondering how I can improve the speed on this method for solving a particular system of coupled recurrence equations. The system is $$ \begin{align*} &V(m)=\alpha + \beta V(m+1)+\beta ...
-2
votes
1answer
71 views

How to generate normally distributed random number [closed]

I want to sample or return random number from a distribution which is normally distributed with mean of zero and standard deviation of 1. I am using RandomReal[NormalDistribution[0, 1]] I s this ...
-2
votes
1answer
107 views

Why does Mathematica “sleep” when I don't work at computer? [closed]

I started using Mathematica few days ago. I'm running this code: ...
0
votes
1answer
66 views

numerically solving

I am trying to solve for [Lambda] as a function of a (unknown) from this expression ...
0
votes
0answers
40 views

Second derivative using ND [duplicate]

I have a function g=f(x,t). The function "g" came from a numerical integration: g[x_?NumericQ,t_?NumericQ]:=NIntegrate[tt[x,r,t],{r,rmin,rmax}] and tt(x,r,t) ...
4
votes
2answers
107 views

Imaginary terms in the derivative of Jacobi theta function (2) on the real line

I am trying to calculate/plot the derivative of the second Jacobi theta function $d\theta_2(0, e^{-\pi t} )/dt$. Calculating or plotting the function itself works fine: ...
2
votes
0answers
42 views

How do I numerically integrate over a data set that has uncertainties? [closed]

I have a 1D data set {xi, yi} with no uncertainties in xi and with uncertainties dyi in yi. The resulting discrete function is monotonic and relatively smooth and I would like to integrate the ...
3
votes
1answer
102 views

compute the gradient in high dimension

The following code is used to compute the gradient of a given 2D data. ...
3
votes
1answer
86 views

Why is the Spherical Bessel Function acting strangely at this point?

I'm doing some computation that requires the use of Spherical Bessel Functions of the 1st kind, at high orders and values. So, I managed to find this, while running it over a wide range of values. I ...