Questions on the numerical functions of Mathematica, implementing numerical methods and numerical computing with Mathematica.
2
votes
2answers
109 views
0
votes
0answers
361 views
Jacobi eigenvalue and eigenvectors algorithm
Suppose we have a symmetric matrix with dimensions n x n. I need to find the eigenvalues and eigenvectors of this matrix using the Jacobi method. I wrote this code:
...
2
votes
1answer
425 views
Forcing FindRoot to return only real solutions
FindRoot documentation reports that if the equation and the initial point are reals, the solutions are searched in the real domain.
However, in the following case I ...
8
votes
3answers
842 views
NDSolve with Euler method
I want to solve this equation with NDSolve[] using the Euler method:
x'[t] == 0.5*x[t]-0.04*(x[t])^2
with initial condition ...
3
votes
1answer
62 views
Monitoring the Evaluation of NDSolve: time to finish estimation
My problem is quite simple: I run a NDSolve with a system of many ODEs, a calculation that will run for many hours, and I would like to know the progress of the ...
0
votes
1answer
51 views
How to convert Approximate number to exact Fractions? [closed]
When solving certain equations Mathematica warned of using approximate numbers, and does conversion to exact number by default, followed by yet another conversion back to approximate results, like
...
5
votes
1answer
85 views
Accurately evaluating the hypergeometric function
As part of another problem, I am working to evaluate hypergeometric functions such as
Hypergeometric2F1[1, 1, n, -1]
for large $n$. I am hoping to obtain at ...
18
votes
1answer
758 views
Identifying critical points of 2/3D image/cubes
Upshot
I am interested in identifying critical points of a 3D field/cubes (maxima, minima, tube-like and wall-like saddle points) and 2D field/image (maxima, minima, saddle points). I.e. the ...
9
votes
2answers
281 views
Numerical partial derivative
For a one-variable numerical function, it's simple to calculate the derivative at a point with Derivative as Szabolcs has pointed out before:
...
-2
votes
0answers
56 views
Problem in evaluating numbers [closed]
I have some problem evaluating numbers.
I have this instruction (H is an Hamiltonian), and I want my system to evolve to a certain state.
...
4
votes
0answers
80 views
Computation of Hankel Transform using FFT (Fourier)
To address circular symmetric cases of 2D Fourier Transformations the so called Hankel Transform can be applied (for a detailed derivation of the relation between the 2D Fourier transform and the 1D ...
0
votes
0answers
54 views
Initializing Minimization [duplicate]
I am trying to implement a model predictive control scheme in Mathematica, e.g. I optimize input sequences by predicting future outputs. So every time I call the cost function it will simulate the ...
1
vote
1answer
38 views
Set theoretic operations on sets of real numbers
I have two pieces of code that produce a bunch of real numbers, say $A$ and $B$ respectively. (It is not relevant to the question, but $A$ consists of eigenvalues of the Hamiltonian of some physical ...
0
votes
1answer
75 views
Plotting the Bessel function with a float argument [closed]
The equation I am working with is
$$ E = M_e + \sum_{n = 1}^N\frac{2}{n}\mathcal{J}_n(ne)\sin(nM_e) $$
where $\mathcal{J}_n(x)$ is the nth Bessel function of the first kind.
When I enter the ...
4
votes
0answers
98 views
Numerical solution of Schrödinger-type equation in Mathematica [duplicate]
I want to solve the following differential equation numerically:
\begin{equation}
i\partial_{t}\psi(r,t)=\left[-\frac{\Delta}{2m}+g\left|\psi(r,t)\right|^{2}+V_{d}(r,t)\right]\psi(r,t)
\end{equation}
...
1
vote
3answers
73 views
How to calculate solution for each variable automatically
Here I have one problem how to calculate x for each y. In this form code doesn't work
...
1
vote
3answers
99 views
Making a calculation with high precision
I would like to make the following calculation:
1/Sqrt[1 - (150^2 10^(-4))/(9 10^16.)] - 1
Mathematica 8 returns 0. The result is obviously not 0, but my ...
-2
votes
0answers
55 views
2
votes
0answers
68 views
Speeding up a numerical constrained quadratic optimization
I'm trying to solve a quadratic optimization problem in 35 variables, $\vec{α} = \left< α_1, \ldots, α_{35}\right>$:
$$
\begin{aligned}
&\operatorname*{maximize}_\vec{α}&&1.0\cdot ...
10
votes
2answers
366 views
Is it possible to use the LevenbergMarquardt algorithm for fitting a black-box residual function?
I have a black-box multiargument multiparametric function of the type SRD[dataPoint_List,params_List] which accepts experimental data along with the parameters of ...
2
votes
2answers
106 views
28
votes
1answer
509 views
0
votes
1answer
165 views
DAE - varying initial conditions
I want to solve a DAE-system and I want to vary more than one initial conditions and to manipulate them. I looked here:
Putting NDSolve into ParametricPlot
But it does not work:
...
2
votes
0answers
31 views
NIntegrate/NSum with parameters [duplicate]
I'm trying to calculate a continuous integral within a discrete integral.
Something similar to this (yet more complex):
...
4
votes
2answers
109 views
10
votes
1answer
232 views
Why can't I change the value of MaxRecursion in NIntegrate when integrating BesselJ?
I am trying to evaluate this integral numerically
$$
\int_0^{\infty } J_0(q R) \tanh(q) \, \mathrm{d}q
$$
for large values of $R$. This makes the integrand oscillate more quickly and Mathematica ...
0
votes
1answer
70 views
0
votes
0answers
63 views
7
votes
0answers
162 views
Numerically solve 2nd order differential equation with singularity
Consider a second order differential equation with a potential that diverges at some generic value in the variable. For example:
$$-y^{\prime\prime}(s)+\frac1{\mathrm{cn}{(s\mid k^2)}}y(s)=0$$
where ...
1
vote
1answer
104 views
why there is a small imaginary part [closed]
I encountered a problem. I have a eigenvector eigvsI[1]
...
1
vote
1answer
169 views
Why is arithmetic faster for inexact arithmetic?
I have been trying to compute eigenvalues of a rather sizable matrix A, about $500 \times 500$ (but sparse). I asked Mathematica to compute ...
3
votes
1answer
197 views
NDSolve for a large system of simple ODEs
I am solving a system of many (more than 100) ODEs.
It is the kind of standard rate equation encountered in semiconductor physics.
Here is the system:
...
4
votes
2answers
296 views
Any ideas on how GeneralMiniMaxApproximation is implemented?
GeneralMiniMaxApproximation is used to construct minimax approximations of parametrically defined functions. I am curious about how ...
4
votes
1answer
74 views
Minimize failing on a polynomial
Calling:
Minimize[{-0.4877 - 0.1190 r^2 - 0.1885 r^4 + 2.9703 z - 0.5531 z^2,
0 <= z <= 3.5 ∧ 0 <= r <= 1.75}, {r, z}]
returns ...
1
vote
0answers
131 views
Adapting NDSolve to circumvent NDSolve::bdord: error for 1-D Euler Equations
I attempted to use NDSolve for the 1-D isentropic unsteady flow equations with low subsonic inflow velocity and prescribed inflow total enthalpy; along with a ...
3
votes
0answers
139 views
FindRoot gives a wrong solution which obviously should not be there
I got stuck on FindRoot and I didn't see any similar problem posted, so let me explain what I am trying to do and what problem I meet here.
I try to find roots of a particular function, which in the ...
5
votes
1answer
127 views
FindMaxValue specifics
I'm using FindMaxValue to study the distribution of maxima of Abs[RiemannSiegelZ[t]] between consecutive values of ...
0
votes
0answers
46 views
How to force evaluation/numerical result of a function? [closed]
I defined a function m[x] using
...
2
votes
0answers
76 views
Why is FindRoot initial value far from the specified one?
I am trying to numerically find the root of a function that looks a bit like: 1/x - (SchurDecomposition[A[x]][[2]])[[1]], where ...
7
votes
2answers
450 views
How do you force a decimal output? [duplicate]
I have some very small values such as 2.601519253*10^-8. I'd like to output these values to CSV for another program to work with. I've tried N[value, 50], but Mathematica still insists on producing ...
0
votes
0answers
153 views
Rounding values [duplicate]
In Mathematica 8 when I enter 1 - 0.99 - 0.01 I get 8.67362*10^-18 instead of zero. How do I fix this problem?
I am getting ...
13
votes
1answer
310 views
Optimizing a Numerical Laplace Equation Solver
Laplace's Equation is an equation on a scalar in which, given the value of the scalar on the boundaries (the boundary conditions), one can determine the value of the scalar at any point in the region ...
10
votes
6answers
2k 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 ...
6
votes
1answer
471 views
Handling failed FindRoot calls
I want to handle FindRoot calls which did not converge (e.g "thrown" error message FindRoot::cvmit)
...
1
vote
1answer
81 views
Plot FindRoot for non-trivial function
I would like to plot the results of FindRoot over certain range of inputs. I tried to do this with the code:
...
3
votes
1answer
78 views
Find point at which equation stops having roots (if it exists)
I am interested in the roots of this function:
f[M_, b_] := 1 - (2 M Gamma[2, 0, (1/M + b M)/Sqrt[b]])/(1/M + b M)
for fixed values of b. In particular I want ...
1
vote
2answers
137 views
How can I use FindRoot on an expression from NDSolve?
I have a second order ODE that I can only solve numerically using NDSolve, but I then need to use the solution in FindRoot and am running into errors. A simplified but analogous problem is the ...
35
votes
10answers
1k views
Can Mathematica propose an exact value based on an approximate one?
Sometimes, I use Mathematica to do some hypothesis on homeworks to make the question easier. For instance, when I have to compute big sums when $n\to\infty$ and Mathematica can't give the exact ...
19
votes
2answers
1k views
Why round to even integers?
According to the Mathematica help:
Round rounds numbers of the form x.5 toward the nearest even integer.
For example:
Round[{0.5, 1.5, 2.5, 3.5, 4.5}]
...
0
votes
1answer
90 views
How to guess initial complex value for FindRoot
I have to solve a transcendental equation for a parameter, say $\beta$. Now, the $\beta$ has a range from $ik$ to $k$ where $i$ is the usual imaginary root $\sqrt{-1}$ and $k$ is a real number. ...





