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

learn more… | top users | synonyms (1)

1
vote
0answers
19 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
1answer
54 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 ...
4
votes
1answer
172 views

Mod[1.2, 0.2] is not equal to zero

Why doesn't the following expression evaluate to zero? In[1]:=Mod[1.2, 0.2] Out[1]=0.2 Edit: This is what I wanted to do: ...
1
vote
0answers
101 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
1answer
44 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 ...
0
votes
0answers
61 views

JacobiCN inaccuracy [on hold]

For my calculations I need JacobiCN[s,k] for s near 0 from the left and k near 1 from the ...
28
votes
1answer
950 views

Fast Spherical Harmonics radiative transfer

This is a rather specific question and I apologize for spamming you with some lengthy code. But it could be interesting for some reader and maybe you can help out, so please bear with me. I am using ...
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 ...
22
votes
8answers
5k views

About multi-root search in Mathematica for transcendental equations

I have some questions for multiroot search for transcendental equations. Is there any clever solution to find all the roots for a transcendental equation in a specific range? Perhaps ...
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 ...
2
votes
0answers
54 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 ...
12
votes
1answer
2k views

Computation of Hankel Transform using FFT (Fourier)

To address circularly symmetric cases of 2-D Fourier Transformations, the so-called Hankel Transform can be applied (for a detailed derivation of the relation between the 2-D Fourier transform and the ...
7
votes
0answers
209 views

Mathematica 7: “LessEqual::nord:” error when using NMinimize on a real function

Bug introduced in 7.0 or earlier and fixed in 9.0 I encounter a problem (Mathematica 7) similar to Strategies to avoid LessEqual::nord in NMinimize? but the advised strategies don't work for me. ...
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 ...
14
votes
1answer
422 views

How to determine BLAS/LAPACK implementation used internally for numerical matrix operations?

Is there a command which reveals which implementation of BLAS and LAPACK are used in Mathematica's matrix operations such as Eigensystem? I asked a related question ...
-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$ ...
2
votes
1answer
124 views

NMaximize and Accuracy

I have a problem with NMaximize which is best depicted by the following figure. The result indicates, that the solution mathematica finds seems to be smooth except a few outliers. How can I get rid of ...
6
votes
1answer
411 views

Is there no documentation for Method in Eigensystem?

There does not appear to be any documentation on how to use Method in Eigensystem, or at least not in Version 9.0.1 of ...
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 ...
16
votes
2answers
969 views

How to compute the inverse CDF of HyperbolicDistribution properly?

Fixed in version 9. I want to compute the CDF and inverse CDF of the hyperbolic distribution: ...
5
votes
1answer
519 views

How to solve fluid flow problem based on Navier-Stokes equations?

Does anyone know or can provide any examples how fluid flow problem can be formulated and solved in Wolfram Language? Simplest cases of 1D or 2D flows based on Navier-Stokes equations or even their ...
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 ...
3
votes
2answers
146 views

WorkingPrecision causes issue in the NIntegrate

I really can't figure out why my code sometimes is not working. My integrals involve two variables (k and kz). The integration ...
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
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 ...
9
votes
2answers
674 views

Problem with numerical evaluation of analytically solved integral, solution way off

The following command in Version 9.0.1: N[Integrate[x^50*Sin[x], {x, 0, 1}]] gives $1.4615\times 10^{48}$ which is way off from the correct solution which is ...
20
votes
7answers
599 views

Elegant high precision `log1p`?

Sometimes it is hard to understand how numerical expressions are evaluated. I remember reading claims by Wolfram on how smart the Kernel is to evaluate expressions trees numerically by recognizing ...
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. ...
0
votes
1answer
105 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
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 ...
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. ...
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 ...
5
votes
2answers
377 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 ...
3
votes
1answer
127 views

Strange NSum behavior

If I do: NSum[(i + 1)/(i + 2) LegendreP[i, 0] LegendreP[i, 0], {i, 0, Infinity}] I get: 1.25216 If I do: ...
5
votes
1answer
543 views

p-iteration algorithm to solve Lambert's problem for interplanetary trajectories

I've been reading up on using the p-iteration method to solve Lambert's problem for choosing the correct interplanetary trajectory between two planets given the ...
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. ...
4
votes
2answers
112 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: ...
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 ...
4
votes
1answer
240 views

Numerical errors/inaccuracies in ProductLog

Context In cosmology, a fairly accurate model to describe the gravitational potential, $\psi(r)$ of dark matter halos is given by $\psi( r)=\log(1+r)/r$. ...
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; ...
10
votes
4answers
1k views

Function to subdivide interval into n evenly-spaced points

[This post needs better tags than I could come up with. Edits to the tags would be particularly welcome.] I realize that it is trivial to define a function that takes an interval (i.e. two ...