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

learn more… | top users | synonyms (1)

3
votes
0answers
43 views

Incorporate a Range into FindRoot?

I asked the question Storing Variables in "Loops" and Point Plotting yesterday, and thanks to unbelievable assistance, I've almost got exactly what I was hoping for. I have the function ...
0
votes
0answers
40 views

Evaluate result from NDSolve is slow

I am calculating some partial differential equations with NDSolve, it does it well. However when I try to Evaluate the ...
3
votes
2answers
199 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
124 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
17 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
111 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
56 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
162 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
61 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
312 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
184 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
46 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
192 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
91 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
136 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
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
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
48 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
81 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
60 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
122 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
49 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
88 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
82 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
103 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
43 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
54 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
57 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
197 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 ...