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

learn more… | top users | synonyms (1)

0
votes
1answer
18 views

EquationTrekker using Mathematica 10.2

I wonder whether the problem that arise with the following code is specific to my machine, as it seem to work with the documentation example. ...
3
votes
0answers
41 views

NSolve doesn't work on an equation containing a numerical integral and constraints

I'm having trouble getting Mathematica to solve equations numerically. I know that its important to specify the type of variables for pattern testing (see e.g. here) but this doesn't seem to work. ...
-3
votes
0answers
32 views

integral-equation of Wentzel–Kramers–Brillouin [on hold]

I need a code that can help me to solve the WKB equation for the eigenenergies for any given potential
2
votes
2answers
132 views

How to solve this two algebraic equation simultaneously for u and H ?(all real number)

I want to find the non-zero value of H when beta is changing(especially what value of beta when increasing will there be a non-zero H value). H is between [0,100]. This is actually the calculation ...
3
votes
2answers
74 views

Maximizing a function defined using NIntegrate [duplicate]

I have two functions fn[x,y,z] which is in integral form and I have another function gn[x,y] which is also in integral form ...
6
votes
2answers
90 views

How to do multi-dimensional principal value integration?

The toy model is: $$\int_{-2}^{2}\int_{-2}^{2}\frac{1}{1-(x^2+y^2)}\, dx\, dy$$ The integrand have opposite sign across the circle $x^2+y^2=1$, so one would expect that the integral has meaning only ...
0
votes
0answers
35 views

Numerically finding a single root of a polynomial system

I may be off base, but from the documentation, it sounds like NSolve is specifically tailored to finding (all) roots of a polynomial system. On the other hand, ...
0
votes
1answer
44 views

Solving recursions

This question is tied to my previous question. I have a few recursion formulas, and I keep getting Recursion depth of 1024 exceeded. error. I need to get the ...
8
votes
1answer
104 views

FindMaximum failing on a trivial problem [on hold]

I am trying to solve a trivial optimization problem with FindMaximum but for some reason it is not going. I reduced the problem down to the following non-working ...
4
votes
1answer
100 views

Why doesn't NSolve work for this equality? Wildly incorrect solutions are given in certain cases

I am trying to write a function that solves for p in the following equation: PDF[BinomialDistribution[n, p], x] == op The ...
3
votes
1answer
37 views

In NMinimize, how can I efficiently handle NIntegrate errors for non-integrable functions?

I am using NMinimize to find parameters that minimise the integral of a function in the least squares sense: ...
4
votes
4answers
244 views

How to stop a summation when a variable is small enough?

I meet with a problem. I hope to get an infinite summation of $f1(x)/f2(x)$ which converges to zero. So my code is Sum[f1[x]/f2[x],{x,Infinity}] or ...
1
vote
2answers
62 views

Condition on Inside of Region

How do I handle boundary conditions present in the region. Mathematica complains about the condition v [1 , t ] == u [1,t]. The condition should be given to this ...
0
votes
2answers
69 views

Varying results from the Round function

My problem is simple. Consider the following. ...
3
votes
1answer
75 views

High precision calculation of infinite product involving prime numbers

I'm recently studying some topics in analytic number theory and I have encountered results involving the infinite product $$C=\prod_{p}\left(1-\frac{1}{p(p+1)}\right)$$ where $p$ denotes calculating ...
3
votes
2answers
65 views

How to use Evaluation Monitor in conjunction with NonlineaModelFit?

I am trying to find out how many function, gradient and hessian evaluations are made when i run NonlinearModelFit for example in this case ...
0
votes
0answers
56 views

NDSolve fixed step problem

Working example here: Drive folder (have both files in the same directory! Notice: the line <<variables' in the file seems to throw an error for me, but ...
1
vote
0answers
44 views
0
votes
0answers
33 views

Timing of associated Legendre polynomials

I encountered a strange issue with the associated Legendre polynomials implemented with LegendreP[l,m,z]. Quite simply, the time used for the numerical computation of those quantities depends on ...
8
votes
1answer
179 views

SymplecticPartitionedRungeKutta shows strange error

Bug introduced in 9.0 or earlier and persisting through 10.2 or later I tried to solve Hamiltonian system ($Q$ is a vector of all generalized coordinates, $P$ - of generalized momentum) $$ ...
3
votes
1answer
86 views
5
votes
1answer
93 views

Why doesn't Rationalize work for 0. in Interval?

Same motivation as this q. Why doesn't Rationalize work for 0.? Interval[{0., 1.}] // Map[Rationalize, #, {2}] & ...
1
vote
0answers
26 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
71 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
52 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
105 views

MatrixExp of a complex matrix of size about 10000 by 10000 [closed]

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. ...
2
votes
0answers
61 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 ...
2
votes
0answers
65 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 ...
9
votes
1answer
150 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}}\\ ...
3
votes
2answers
209 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
133 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
37 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
19 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
114 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
45 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
61 views
0
votes
1answer
71 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
171 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
40 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
63 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
338 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
192 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
59 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
49 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
201 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
96 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
63 views

Can Someone Please Explain Internal`$SameQTolerance?

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