Questions on the numerical functions of Mathematica, implementing numerical methods and numerical computing with Mathematica.
8
votes
1answer
234 views
ReplaceAll[] and Limit[] don't give correct results for this expression under extreme variables [duplicate]
Possible Duplicate:
Funny behaviour when plotting a polynomial of high degree and large coefficients
1/x^2 + (3 + x)/(6 (1 - Exp[x] + x))
——This is a ...
8
votes
2answers
519 views
RootSearch for complex or multiple equations
First the background. I'm trying to solve for the roots of a rather messy complex equation. This is not the exact equation, but it's a decent (simpler) stand in:
...
8
votes
1answer
360 views
Is there any automatic differentiation package?
I'm wondering if an automatic differentiation package exists for Mathematica.
This is what I mean by automatic differentiation.
7
votes
3answers
253 views
Distances between points in periodic cube
How can one implement more efficiently/elegantly/memory savvily the following function which returns a matrix of all Euclidian distances between points in 3D within a cube of width ...
7
votes
1answer
147 views
SetPrecision within Block
I am reading Mathematica Cookbook, chapter 1.
Author gives two examples, with the following explanation
You can control precision within a complex calculation (without using
...
7
votes
2answers
249 views
Precision differences
I run this sum and get the symbolic answer below :
Sum[ (1/(k^2 - k) - 1/k^2), {k, 2, Infinity}]
$2 - \frac{\pi^2}{6}$
I look up the sequence on OEIS and ...
7
votes
2answers
376 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 ...
7
votes
2answers
305 views
How to apply restrictions to the “integrated” variable, when using NDSolve?
I have to integrate an energy along a path. I know the energy at the "beginning" of the path (energy[0]), and I can determine the energy change (gain and loss) ...
7
votes
1answer
339 views
Implementation of Incomplete Fermi-Dirac Integral in Mathematica
I'm working on a special algorithm to implement a more accurate effective mass calculation for hole carriers in silicon in Mathematica. This rather involved algorithm uses incomplete Fermi-Dirac ...
7
votes
1answer
193 views
Converting other C++ classes to MTensor in LibraryLink
Hopefully this will be a quick question + a quick answer:
Say I have a C++ (or C) code using LibraryLink. I am using a library that defines a specific matrix class, as many numerical libraries ...
7
votes
1answer
237 views
Symbolic Integration along contour: branch cut problem?
Context
Following this question on path integrals in the complex plane, having defined again a numerical and symbolic integrator along a path as
...
7
votes
1answer
305 views
AccuracyGoal,PrecisionGoal, WorkingPrecision and NDSolve
I'm trying to understand exactly what WorkingPrecision, AccuracyGoal and PrecisionGoal mean for the result of NDSolve.
I presume WorkingPrecision simply means the number of decimal places used ...
7
votes
1answer
340 views
Using Mathematica to help to determine the consistency of and numerically solve systems of non-linear equations
The formal problem
The question I am about to ask is applicable to many scientific and engineering problems. In short, I am bout to ask for pointers and practical advice for Mathematica beginners who ...
7
votes
0answers
137 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 ...
7
votes
0answers
279 views
Dual complex integral over implicit path using contour plot
Context
I am interested in doing double contour integral over paths which are defined implicitely.
For the sake of debugging, let's assume its
$$\oint_{\cal C}\oint_{\cal C} \frac{1}{u\, x} d u d x$$ ...
6
votes
1answer
311 views
Is Abs[z]^2 a bad way to calculate the square modulus of z?
For a numerical quantity z, Abs[z] returns the square root of the sum of the squares of the real and imaginary parts of ...
6
votes
2answers
364 views
Number of iterations in NSolve
In Excel's solver, one can define how many iterations are to be done, to one's liking.
I am wondering if this is possible to do with NSolve in Mathematica?
Code
...
6
votes
1answer
457 views
Handling failed FindRoot calls
I want to handle FindRoot calls which did not converge (e.g "thrown" error message FindRoot::cvmit)
...
6
votes
1answer
279 views
Tridiagonal symmetric matrix eigenvalue using bisection
I know that Eigenvalues is already quite well implemented in Mathematica, nor am I foolishly trying to improve on it. In order to improve my programming skills, I ...
6
votes
1answer
213 views
Numerical problems with calculation of function
I have a problem with a calculation which I try to do with Mathematica (8.0.1).
I have the following function which describes a cone (with half opening angle ...
6
votes
2answers
210 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:
...
6
votes
0answers
68 views
Mathematica 7: “LessEqual::nord:” error when using NMinimize on a real function
I encounter a problem (Mathematica 7) similar to Strategies to avoid LessEqual::nord in NMinimize? but the advised strategies don't work for me. Also, I get different results with different ...
5
votes
3answers
363 views
How do you round numbers so that it affects computation?
I'm trying to make a demonstration of how rounding to different numbers of digits affects things but I can't find a way to round numbers to a specified number of digits.
The ...
5
votes
3answers
770 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 ...
5
votes
3answers
480 views
Solution for equation system with piece-wise defined functions
As I could swear this worked just yesterday, I am probably just doing something stupid here and I am sorry to bother you :)
I am trying to find the point where a curve crosses a line. In this case, ...
5
votes
1answer
121 views
FindMaxValue specifics
I'm using FindMaxValue to study the distribution of maxima of Abs[RiemannSiegelZ[t]] between consecutive values of ...
4
votes
3answers
383 views
Output of NonlinearModelFit differs from the correct result
I'm having a bad time dealing with the NonlinearModelFit in Mathematica 8, since the result given is a bit imprecise. An example is given on potential regression, ...
4
votes
2answers
174 views
How to solve this trigonometric system of equations numerically?
How can the following trigonometric system of equations be solved numerically?
...
4
votes
4answers
701 views
Numerical Differentiation using 1500 data points
I have a set of 1500 data points (which are some energy eigenvalues) corresponding to a parameter H0 (which represents magnetic field. H0 values are equispaced going from $-3.0$ to $3.0$ in steps of ...
4
votes
3answers
222 views
How to cancel floating point factors?
I am currently having problems with some floating points.
I have a function, which gives as an intermediate result (for example)
...
4
votes
2answers
104 views
4
votes
2answers
138 views
Finding all/most roots of a discontinuous function more consistently?
I have the equation:
f[x_]:=α Tan[α*a] - Sqrt[c - α^2]
and ideally I want to find all of its positive zeros, given a and c, with variable alpha. The problem is ...
4
votes
1answer
144 views
How do I get a list of digits for a number?
I have this 200 digit number where I want to get the IntegerDigits, but the decimal point is in the way.
...
4
votes
2answers
293 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
73 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 ...
4
votes
1answer
154 views
Is there a way to globally set when to treat a very small number as zero?
I understand that I can use Chop to force a very small number to be treated as 0 and can use ...
4
votes
2answers
250 views
Can the CholeskyDecomposition function in Mathematica be made to work on non-symmetric matrices?
The CholeskyDecomposition[m] function in Mathematica requires a symmetric and positive definite matrix m.
For instance, the ...
4
votes
1answer
230 views
How to fix errors in Gram-Schmidt process when using random vectors?
I first make a function to get a random vector on unit sphere in a swath around the equator. That is what the parameter $\gamma$ controls; if $\gamma = 1/2$, the vectors can be chosen anywhere on the ...
4
votes
1answer
178 views
NDSolve does not respond
For some sets of constants, NDSolve gives me true solutions, but when I try for example, T = 1/(2*2200), Mathematica does not respond. What can I do? The code below ...
4
votes
1answer
189 views
How can I get Mathematica to allow me to apply FindRoot to an expression that contains NIntegrate?
I am trying to run the following command in Mathematica:
FindRoot[NIntegrate[D[f[x], x] / Sqrt[1 - x^2], {x, 0, 1}] - d, {a, 245}]
As you might expect, a is ...
4
votes
1answer
161 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:
...
3
votes
4answers
269 views
How can I get the value of a at “t=2.4985352432136567” in the following expression?
By running the following code:
...
3
votes
3answers
265 views
How can I solve Tan[t] - t == F[x] for t as a function of x?
How can I solve the equation Tan[t] - t = Ax, where A is a constant for t[x]?
I know that ...
3
votes
2answers
135 views
3
votes
2answers
161 views
Numerically finding a derivative jump of a function
How would I numerically find where a function has derivative jumps?
In particular, I'm working with this function:
...
3
votes
1answer
331 views
Symbolic integration in the complex plane
Context
While answering this question, I defined (symbolic and numerical) path integrations as follows
...
3
votes
1answer
106 views
Identifying `Indeterminate` elements [closed]
I want to identify if a variable, which is the result of a calculation, is Indeterminate. I was trying to do this using If[]. ...
3
votes
1answer
379 views
MaxSteps and Computing time issue for Solving Differential equation in Mathematica
When we solve differential equation numerically using NDSolve then sometimes we get error like NDSolve::mxst: Maximum steps reached
According to Mathematica docs ...
3
votes
1answer
98 views
Strange behaviour of PolyLog Function
I discovered some strange behaviour of the PolyLog[] Function in Mathematica which seems to me like a bug in the function implementation.
It looks like ...
3
votes
2answers
426 views
Numerically Solving two dependent Transcendental Equations
I need to solve a system similar to the following (Except it is quite large. Solving this ought to do the job):
$$ \tan[2f(t)] = 1+ t^2\ $$
and
$ f(t) $ is $ k $, such that$$ \tan[2kt]-(1+k^2) = 0\ ...


