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

learn more… | top users | synonyms (1)

6
votes
1answer
526 views

What are the algorithm details of FindRoot?

The Help page of FindRoot says: "by default, FindRoot uses Newton's method (Newton-Raphson) to solve a nonlinear system". But I ...
6
votes
3answers
249 views

Finding the square root of a squared number?

Taking the square root of the square of a number Variable set to a real value I'm wondering why these examples a = -4.3; Sqrt@a² Sqrt@(a^2) Sqrt[a^2] Sqrt[a²] ...
6
votes
3answers
79 views

Numerically integrating a list-valued function [duplicate]

I want to NIntegrate a List valued function foo[x] which is only defined for numerical ...
6
votes
2answers
300 views

No builtin function for bitwise rotation?

There appears to be no builtin Mathematica function for bitwise rotation. Is that true? I suppose I can write my function: ...
6
votes
1answer
191 views

Iteration process involving several functions

I would like to carry out a following iteration process: Apply function f1[a_,b_,c_,d_] to a starting list l1={a1,b1,c1,d1}, ...
6
votes
1answer
273 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
1answer
124 views

Is it possible to disable assumptions used by FullSimplify for zero testing [closed]

Sometimes when I invoke FullSimplify on a large expression, I get a series of messages like this: ...
6
votes
0answers
138 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
4answers
340 views

Display a number in Mathematica 9 in periodic form

I want to display a rational number in Mathematica in periodic style. PeriodicForm isn't working anymore. It worked in Mathematica 5 and now I'm using Mathematica ...
5
votes
4answers
2k 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 ...
5
votes
3answers
284 views

RK4 Gravity Simulator

I have the following RK4 solver which splits the two 2nd order ODEs, used to calculate x and y positions under the influence of a gravitating body where $$x''(t)=\frac{G m ...
5
votes
1answer
399 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 ...
5
votes
1answer
209 views

Optimizing Monte Carlo simulation of a Pred-Prey model

My assignment and code As part of an assignment for one of my classes, I'm trying to run a "massive" Monte Carlo simulation in Parallel on the follow model: ...
5
votes
1answer
199 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 ...
5
votes
3answers
789 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
3answers
199 views

Numerical evaluation of a sum

I am trying to compute numerically NSum[(-1)^n/n^3, {n, 1, Infinity}]. Of course, using first Sum would work here, but often ...
5
votes
1answer
146 views

listplot very large numbers

Suppose we have the following function: NN = 150; W[n1_] := NN!/(n1 ! (NN - n1!)) (1/2)^n1 (1/2)^(NN - n1) Then we can Plot or Listplot it: ...
5
votes
1answer
78 views

Why is NHoldFirst not propagated to symbolic derivatives?

I encountered a nasty problem that N cannot evaluate expressions containing a symbolic Derivative of a multi-parameter function ...
5
votes
2answers
538 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 ...
5
votes
1answer
353 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 ...
5
votes
1answer
376 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 ...
5
votes
1answer
229 views

FindMaxValue specifics

I'm using FindMaxValue to study the distribution of maxima of Abs[RiemannSiegelZ[t]] between consecutive values of ...
5
votes
1answer
87 views

How to enforce numerical precision throughout a package

I developed a big package that does quite a bit of numerics. Is there a way to enforce that all numerical computations are done with a pre-defined accuracy? For example, can one use something like ...
5
votes
0answers
210 views

NDSolve and memory usage

After some googling, i've found similar problems around, but didn't find a 100% satisfactory answer, so let me ask here: I'd like to solve a 1+1 problem using the method of lines. In spherical ...
5
votes
0answers
118 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} ...
4
votes
4answers
246 views

How can I name “a[[i]]” the parts of Table “a”? Or how to make Table “a” grow inside FindMinimum?

Let's say I want to minimize a function that uses a Table named a with the Conjugate Gradient Method of ...
4
votes
3answers
590 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
3answers
309 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
3answers
375 views

Creating a 3D List Line Plot From Discrete Points

Given the following Runge-Kutta ODE solver and the graphical output below, how do I get a 3D line plot instead of a 3D point plot? I see that there is no ListLinePlot3D function, so I thought it might ...
4
votes
3answers
252 views

First 10 digits of $\pi$ without rounding

I need to have $\pi$ with an accuracy of $10$ digits. My first guess would be N[Pi, 10] However, this rounds to the last digit instead of just chopping of any ...
4
votes
3answers
163 views

Increasing the precision of a calculation

Clearly I have misunderstood how to do this: I seem unable to understand how to get more digits out of a calculation and I can't see why - the following piece of code illustrates the issue. ...
4
votes
2answers
177 views

Numerical sum does not give consistent results

Consider the function ...
4
votes
4answers
324 views

How to find the maximum of a function on a set of discrete points?

How to find the maximum of a function on a set of discrete points? For example, what is the best way to find the maximum of ...
4
votes
2answers
390 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
192 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
367 views

Numeric calculation of Hessian

I want to calculate the Hessian matrix for a function that can only be evaluated numerically. So far, I have the following (where f is just for testing): ...
4
votes
1answer
424 views

Why IntegerPart[x/(x/2)]=1?

Consider this code x = 0.109354682484; IntegerPart[x/(x/2)] (* 1 *) Precision[x] (* MachinePrecision *) Why does it give 1 ? Version number: 9.0 on Mac 10.9.2 ...
4
votes
2answers
160 views

Graphing convolutions of user defined functions

I am a statistician who is very new to Mathematica. Ultimately I would like to be able to graph convolutions of arbitrary user defined functions. But I can't as yet obtain values of such ...
4
votes
2answers
401 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
206 views

How to solve this trigonometric system of equations numerically?

How can the following trigonometric system of equations be solved numerically? ...
4
votes
2answers
382 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
188 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
171 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
153 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
104 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
190 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
183 views
4
votes
1answer
720 views

Symbolic integration in the complex plane

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