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

learn more… | top users | synonyms (1)

4
votes
2answers
456 views

Why doesn't FindRoot work correctly?

I'm trying to find the roots of the following equation: I need to find λs for different values of ξ. I know that for all ...
4
votes
1answer
212 views

How to solve this trigonometric system of equations numerically?

How can the following trigonometric system of equations be solved numerically? ...
4
votes
2answers
414 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
192 views

Why to do parentheses change the results of a calculation?

I'm getting results that are sensitive to where I place parentheses with respect to operations that are associative1 (and should thus be insensitive to such placement). For example, if I define2 ...
4
votes
1answer
90 views

Changing the definition of N: unexpected $RecursionLimit::reclim error

I have some objects represented as follows: Object[data, param] data is a list of numbers, ...
4
votes
1answer
327 views

Using NDSolve to solve Equation of Motion in cylindrical coordinates

I have a set of coupled differential equations which represents the equation of motion of a particle in cylindrical coordinates with the following Hamiltonian: $$ H=\frac{1}{2m} \left( p_r^2 + ...
4
votes
2answers
164 views

Floating point addition not associative

Can anybody explain the following behavior? x = 0.2 + (0.3 + 0.1); y = (0.2 + 0.3) + 0.1; x == y (* -> True *) But actually the variables do not exactly ...
4
votes
1answer
105 views

Strange behavior of Mathematica regarding calculation time

Today I witnessed the following strange behavior of Mathematica, when it comes to calculation time involving larger nested lists. The following is the short example that I setup, I am sure one can ...
4
votes
1answer
251 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
189 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$. ...
4
votes
1answer
264 views
4
votes
1answer
868 views

Symbolic integration in the complex plane

Context While answering this question, I defined (symbolic and numerical) path integrations as follows ...
4
votes
1answer
775 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 ...
4
votes
1answer
140 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
323 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
1answer
796 views

Mathematica NDSolve and 'Compile'?

Since the consensus is usually that NDSolve speeds fares badly against compiled code such as c++ ODE solvers using GSL say, is it possible to make up for this lag ...
4
votes
1answer
189 views

Find lengths of contours in a ContourPlot

I am trying to find the lengths of different contours in the following plot: It is a complicated piecewise function evaluated on the unit disk. I am hoping there is an easy, generalized way to ...
4
votes
2answers
258 views

Quickly reducing the number of decimal digits for a set of real numbers

How can I quickly convert a number with $n$ decimal points to a number of with $m$ decimal points? Round works, however, it is slower than I would like. This ...
4
votes
1answer
113 views

NExpectation not up to expectations with Boole or Conditioned

Context I am interested in computing numerically the number of extrema at a given threshold for random fields. These numbers are expectations of MultinormalDistributions. Problem This integral ...
4
votes
1answer
298 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
131 views

NDSolve - sampling for result during the computation

I am using NDSolve for a Langevin dynamics problem. I want to the know long term behaviour of my system ($t>1$) but it has to be simulated with very small time steps ($dt\sim 10^{-9}$). An example ...
4
votes
1answer
355 views

Counting the number of operations performed during a calculation

I need to know how can I count the number of operations performed during a calculation of a CompoundExpression. In some of these expressions there are ...
4
votes
0answers
824 views

Numerically solving system of partial differential equation

I am trying to solve a system of partial differential equation with boundary conditions. But I got an error message saying NDSolve::icfail: Unable to find initial ...
4
votes
0answers
410 views

Semidefinite Programming

I want to solve a numerical optimization problem using semi-definite programming. Is there a package or add-on that equips mathematica with this functionality?
3
votes
2answers
273 views
3
votes
3answers
690 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
1answer
321 views

N[number, 100] does not give 100 decimal places [duplicate]

Please look at this computations: a = N[Sqrt[2], 20]; N[a^2, 100] The output is 2.0000000000000000000, which is apparently not $a^2$ to 100 decimal places. ...
3
votes
2answers
245 views

Computing the minimum distance in a contour plot

I have the following Mathematica code ...
3
votes
3answers
262 views

How can I find the sum of the even digits of a number of all elements of a list?

Let $E(n)$ denote the sum of the even digits of $n$. For example, $E(123456789) = 2 + 4 + 6 + 8$. I tried a = IntegerDigits[123456789] and ...
3
votes
3answers
126 views

Solving determinant of a Kronecker product of matrices gives a numerical error - why?

I am doing the following steps (code at the end of the post): I start with a 2x2 matrix (smatrix), which is a function of a single variable (u2). I want to set the determinant of this matrix ...
3
votes
2answers
342 views

Speed of convergence for NIntegrate

I'm trying to optimise numerically a function that entails computing the expected value of a truncated trivariate normal distribution and this is taking extremely long -I also get warned about ...
3
votes
2answers
172 views

Rounding the coeffcients in a polynomial

I have a very large polynomial with Complex Numbers as coefficients. Due to many calculations, there are rounding off errors. I know however by theoretical considerations, that the coefficients are ...
3
votes
1answer
107 views

obtaining real roots of negative numbers in a long expression [duplicate]

I have a complicated symbolic expression which contains many terms like $(a/(a-2))^{1/m}$, where $a/(a-2)$ could be positive or negative after replacement. I only need the real root after ...
3
votes
2answers
89 views

NMinimize/NMaximize is unable to generate initial points

Mathematica 10 generates a warning that it is unable to generate initial points for numerical optimization problems. I picked a particularly simple example. The problem goes away when ...
3
votes
2answers
157 views

How to define even permutations correctly?

I define even permutations as following, but there may be some error. I use it in two different way and get different output. ...
3
votes
1answer
270 views

How can I deal with a non-numerical value for a derivative at $t = 0$ when using NDSolve?

I want to solve two coupled equations with NDSolve, ...
3
votes
1answer
61 views

How to speed up Min of DateObjects?

I'm in version 10.0.1 using a Dataset to do some plots and things. For one of the plots I need to get the minimum date of a some filtered set of the ...
3
votes
1answer
113 views

Bad numerical approximations

I'm trying to do some calculations here, but for some reason Mathematica starts using numerical approximations that are no good for my work. Specifically: ...
3
votes
2answers
169 views

Solve-ing with initially unassigned parameters and Solve-ing using their numerical values produces different results

I am trying to solve an equation using the following piece of code: ...
3
votes
1answer
582 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 ...
3
votes
1answer
214 views

Numerical Error with Large Matrices

I am writing a Finite Element Analysis program in Mathematica. The code involves handling a large matrix with large entries. I get an error when I try to use Mathematica's "LinearSolve" to solve a ...
3
votes
2answers
275 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
93 views

Find the NullSpace of a matrix whose determinant is “almost” zero

If $A$ is a matrix such that $\det(A)=0$, it is easy to get a basis of the kernel of $A$ with NullSpace[A]. Now let's consider a matrix $B$, function of a ...
3
votes
1answer
71 views

How to implement something like NMaximize[ NMinimize [ f(x,y) , {x} ], {y} ]?

Title says it all, really. I want to find some set of values for which a function of those values can't be made larger than a certain number, when some other values (on which that function is also ...
3
votes
1answer
210 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
822 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\ ...
3
votes
1answer
66 views

Leave out a term when summing

I'm calculating the Madelung constant $$\alpha = -\sum_{n_1,n_2,n_3}{\frac{(-1)^{n_1+n_2+n_3}}{(n_1^2+n_2^2+n_3^2)^{1/2}}}$$ Where $n_1,n_2,n_3$ are any element in the integer domain and they can't ...
3
votes
3answers
695 views

Implementing Newton's method

I have this question on coding Newton's method in Mathematica. I have some code to go by but I have no clue if it's computing the functions in the right order. The book is the numerical methods ...
3
votes
1answer
584 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
1answer
117 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 ...