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

learn more… | top users | synonyms (1)

1
vote
0answers
24 views

Function assigning loop misses a beat [duplicate]

Ive come across this in managing a table, but is seems to be reproducible in simpler forms. I simply want to iterate a defined function for various values and then work with those at a later time. ...
4
votes
2answers
63 views

Is there a way for accuracy backtick notation to accept variable inputs?

Backtick notation uses 1.0``20 to give 1 with 20 places of accuracy after the decimal point. But what I want is ...
0
votes
1answer
46 views

Problem with solving coupled differential equations

The following code seem to produce an output that appears to be independent of the parameter "fg". It is possible that the way the code is written might be causing it, but how can one fix this ...
1
vote
0answers
102 views

MatrixExp of a complex matrix of size about 10000 by 10000 [on hold]

I want to apply MatrixExp of a numerical, complex matrix of size about 10000 by 10000, and I also need high precision as I need to multiply several such matrices. ...
0
votes
0answers
36 views

Once working code fails upon restarting Mathematica [on hold]

I had a code which worked flawlessly, then upon shutting down mathematica and re-starting it, the code failed with the following error message: "The function value -Abs[f[0.0228659,I/6]] is not a ...
2
votes
0answers
56 views

Funny behavior when computing dot product of coefficients with high-order polynomials

I have a similar problem to Funny behaviour when plotting a polynomial of high degree and large coefficients. However, the thing being evaluated is not just a polynomial but a dot product of some ...
-3
votes
0answers
64 views

Numerical integration giving trouble [on hold]

Recently I have been struggling with this problem and I think an outside look (and expertise) is what I need. I have a set of equations that in the end give me the tuple ...
2
votes
0answers
62 views

What am I missing in this highly oscillatory integral?

I want to numerically integrate this equation (in python without calling Mathematica): $\int_0^\infty {\rm d}k f(k) J_v(r k) J_n(s k)$ where $f(k)$ is a non-smooth function, $J_v$ are the Bessel ...
7
votes
1answer
108 views

Eisenstein Series in Mathematica?

Mathematica doesn't seem to have built-in tools to deal with the Eisenstein Series: $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_{4}(\tau)= 1+240 ...
-1
votes
0answers
49 views

Evaluate result from NDSolve is slow [on hold]

I am calculating some partial differential equations with NDSolve, it does it well. However when I try to Evaluate the ...
3
votes
2answers
207 views

Storing Variables in “Loops” and Point Plotting

Given the function $y=\sin x$ defined over the region $-\pi \leq x \leq \pi$, I need to implement a "do loop" such that I sweep over 100 or so points $-1 \leq y \leq 1$ and find precisely the two $x$ ...
4
votes
1answer
132 views

Unexpected results from trying to solve Laplace's equation

I am trying to find the solution to Laplace's equation: $\dfrac{\partial^2 u}{\partial x^2}+\dfrac{\partial^2 u}{\partial y^2}=0$ over the following region of space: the vertices of the triangle ...
0
votes
1answer
33 views

Error message when exporting plot as XLS file

I imported data from excel which has 300 data (which are change in CDS spread). I want to compute corresponding CDF for the data using kernel density estimation. I get the CDF plot but cannt get the ...
0
votes
0answers
18 views

How to get rid of numerical scope error? [duplicate]

I am trying to perform a numerical maximization routine on a setdelayed function which involves a numerical integral and I'm getting an error message. The evaluation continues and gives the right ...
2
votes
1answer
112 views

Unexpected Weierstrass $\wp$-Function Behavior

In Mathematica, the Weierstrass $\wp$-function is expressed by WeierstrassP[u + I v, {g₂, g₃}] where g₂ and ...
1
vote
0answers
44 views

Numerical Derivative after numerical integration [closed]

I am trying to find the numerical derivative of a function whose argument defines the bounds of a numerical integral. ...
1
vote
1answer
59 views
0
votes
1answer
70 views

Find all degenerate eigenvalues of a cubic equation

I have an equation that is cubic in w. The three solutions correspond to bands in a bandstructure, and are a function of wavevector ...
6
votes
2answers
163 views

Round vs. Floor vs. Ceiling for non-integers non-orders-of-magnitude

I understand that Round give the nearest even integer for cases where the number is between two integers, i.e. Round[2.5] = 2 ...
0
votes
0answers
39 views

Signage of eigenvector [duplicate]

I am comparing eigenvectors generated from mathematica to matllab. It seems signage of eigenvector generated from Mathematica is opposite from what is generated from matlab. Can anybody review and ...
1
vote
0answers
62 views

Floor inconsistent with Less for machine-precision approximate numbers

For machine-precision numbers, Mathematica uses a tolerance for comparisons, so that 1.-$MachineEpsilon==1. However, Floor does ...
1
vote
0answers
28 views

Function to be used for spectral decompostion of matrix [duplicate]

Can anybody please help in finding out what is best way to do spectral decomposition (or Eigen decomposition) of the matrix. The details of Eigen decomposition can be found in attached link 1. ...
1
vote
0answers
54 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. ...
19
votes
1answer
328 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
188 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
58 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
47 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
195 views
0
votes
0answers
23 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
93 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
60 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
139 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
49 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
34 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
17 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
40 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
52 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
82 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
93 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 ...
9
votes
1answer
162 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 ...
0
votes
0answers
61 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
290 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
124 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
97 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
166 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
80 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
46 views

CharacteristicPolynomial returns 0

I have the following matrix. ...
0
votes
0answers
50 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
89 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). ...