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

learn more… | top users | synonyms (1)

5
votes
1answer
431 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 ...
1
vote
1answer
158 views

NSolve with numerical function

I would like to solve numerically an equation which involves a numerical function constructed by fitting some data: ...
7
votes
1answer
697 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 ...
13
votes
1answer
151 views

CompiledFunction returns machine numbers smaller than $MinMachineNumber

When thinking on the workaround for this LogLogPlot bug suggested by halirutan I noticed that CompiledFunction actually can ...
1
vote
1answer
100 views

How do I get Nsolve to work with hyperbolic functions?

This is a rather simple numerical solution, but it simply doesn't work. Does anybody have a solution? NSolve[x - Sinh[x] - 1 == 0, x] NSolve::nsmet: This ...
0
votes
1answer
66 views

Removing numerically vanishing complex part within NDSolve

I am using functions that are only well-defined for real values (e.g. HeavisideTheta) within NDSolve. Internally ...
9
votes
4answers
402 views

Why is Poisson Random Deviate Generation so slow?

I am generating Poisson deviates for some numerical work. Mathematica 9.0.1 is very slow in generating these random numbers, as can be seen below. ...
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$. ...
6
votes
2answers
333 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: ...
2
votes
4answers
191 views

Padding and formatting within BaseForm

I find using BaseForm to be a little tricky. For example, if you use BaseForm and then do some additional operation all the numbers turn back into base 10, so you have do BaseForm as the "last step". ...
2
votes
2answers
153 views

Incorrect numerical derivative of function that uses FindRoot

I am trying to plot the derivative of function g[x] below where g[x] is defined as the root of another equation. However, I am ...
0
votes
1answer
89 views

Truncate a fractional value to particular number of bits?

If I have a fractional value, how can I truncate (not round) that to a certain number of bits, like 8? For example, for Pi 3.141569265359... the fractional part is 0.141569265359... ...
2
votes
1answer
152 views

Read C-formatted hexadecimal numbers?

I have a lot of 32-bit numbers in hexadecimal symbolized as they are in C (for example, 0x1230abde). How can easily read these in Mathematica?
5
votes
4answers
352 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 ...
6
votes
1answer
204 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}, ...
1
vote
3answers
149 views

automatic processing of numerical results in `Plot`

First I want to solve an equation $F(x,y)=0$ for $y$ by supplying a value of $x$. (suppose obtaining the analytic form of $y(x)$ is too difficult) Then I want to plot root $y$ (numerically calculated) ...
0
votes
0answers
112 views

Getting increased accuracy for roots of determinant

I have a matrix $a(\kappa)$ from which I am trying to determine $\kappa$ by using the equation $det(a(\kappa)) = 0$. The matrices I deal with are on the order of 100 X 100 to 500 X 500. Originally I ...
3
votes
1answer
412 views

Numerical solution of Bessel-like equation using NDSolve

I need to calculate solution of Bessel-like equation having general form: $\frac{d^2F}{dr^2}+\frac{1}{r}\frac{dF}{dr}+Q(r)F(r)=0$. Problems come from the points near $r=0$ leading to numeric errors. ...
1
vote
1answer
108 views

Passing f[x][[1]] to FindRoot [duplicate]

FindRoot seems to fail for most examples of the form f[x_?NumericQ] := {x - 3 , x^3}; FindRoot[f[x][[1]], {x, 3}] ...
1
vote
3answers
341 views

Can plot a function, NSolve takes too long

I'm new to Mathematica, so maybe mine is an easy to solve issue, but I haven't been able to figure it out. I have a series of linear ODEs I solve using for: ...
2
votes
1answer
250 views

Animated Wave Propagation using Fourier & InverseFourier

This is a continuation off of previous help on the first part of my project: fourier issue arising from input miscommunication Now I want to go one step further in the current code. Here's the code ...
3
votes
3answers
700 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 ...
12
votes
2answers
295 views

Why do NumberForm and Round apparently use different tie-breaking methods?

When rounding numbers (for example, rounding a real number to the nearest integer), the "round to nearest" rule is usually used. For example, 1.4 is rounded down to 1 and 1.6 is rounded up to 2. ...
1
vote
1answer
168 views

Using NMinimize Properly

I'd like to find the point on a Bezier curve that's closest to some other point. The tricky thing is that because Bezier curves can loop around, the distance function can have multiple local minima ...
12
votes
1answer
894 views

Numerical solution of coupled ODEs with boundary conditions

I have to solve the following set of ODEs and just can't get good results using Mathematica $$ r\frac{d}{dr}\left(\frac{1}{r}\frac{d}{dr}A(r)\right)-\xi^2F(r)^2\left(A(r)-1\right)=0 $$ $$ ...
1
vote
3answers
493 views

How many iterations of Newton's method are needed to achieve a given precision?

Consider using Newton's method to solve the equation $arctan(x) = 0$. Using an initial guess of $x_0 = 1/2$ produces a sequence that converges rapidly. After $8$, iterations, $x_8$ is accurate to well ...
7
votes
1answer
92 views

Need a generalization of RootApproximant to recognize linear combinations over algebraic numbers

RootApproximant does a very good job when I need to recognize an algebraic number and when enough of its digits are known (or even when an unlimited number of ...
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 ...
9
votes
1answer
396 views

ParallelEvaluate for function minimization

Is there a parallelized version of a minimization routine available in Mathematica? The objective function is non-linear and the gradients have to be numerically computed. Every function evaluation ...
4
votes
2answers
259 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 ...
5
votes
0answers
273 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 ...
1
vote
0answers
48 views

Rounding to the nearest decimal [duplicate]

If I have a bunch of numbers in a list {1.435243523432,2434.2321321412,5.8239897,...}, without multiplying everything by some power of ten and then dividing by that ...
0
votes
2answers
107 views

Error in the result

I want solve the following equation: $ x''(t) + 9 x(t) = Cos(3t) ,\; t \in [0,10] $ $ x(0)= x'(0) =1$ I have to use the Explicit Euler method and a partition of the interval in $N+1$ ...
4
votes
4answers
357 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 ...
2
votes
1answer
249 views

How to make Mathematica try harder to perform symbolic comparisons?

(I suspect this question is a duplicate, but I didn't find a sufficiently similar question with an answer to it.) I'm having trouble with comparisons of symbolic ...
8
votes
1answer
155 views

Exp of big negative numbers [duplicate]

I noticed that Exp have a strange behaviour with big negative numbers ...
1
vote
1answer
181 views

Domain restrictions for NMaximize

I am trying to solve a maximization problem, where my variable can only take a limited number of values. (Probably) the easiest example would be ...
2
votes
1answer
236 views

How can I numerically solve for fractional functions and fractional derivatives?

I would like to plot fractional functions. Say $f=(\sin)^{1/2}(x)$. By that I mean that $f(f(x)) = \sin(x)$. Similarly I can define a half-derivative to be an operator such that $H[H[f(x)]] = ...
7
votes
2answers
434 views

Is there any fast way to solve a quadratic matrix equation in Mathematica approximately?

Let the square nonsingular matrix $M$ is a given convergent matrix. What are the best scalar values for $\alpha$ and $\beta$ (in the real numbers domain), at which the following quadratic matrix ...
3
votes
0answers
104 views

Strange NSum behavior

If I do: NSum[(i + 1)/(i + 2) LegendreP[i, 0] LegendreP[i, 0], {i, 0, Infinity}] I get: 1.25216 If I do: ...
2
votes
1answer
392 views

Crank-Nicolson with NDSolve?

As far as I understand, the Crank-Nicolson method (a.k.a. trapezoidal method) can be expressed as a second order implicit Runge-Kutta method. It's Butcher tableau is: ...
2
votes
1answer
94 views

Use Mathematica to determine the falling law

We have a one-variable equation $\rho(R)$ where ρ = (14656.4+277.526*R^2)/(45.9225+R^2)^{5/2} + 0.370036/(R*(0.25+R)^3) This equations describes the evolution of ...
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 ...
-1
votes
1answer
276 views

Help in NIntegration Methods - Takes too long, why?

I have this code. It is a triple integral, and using the automatic method gives me a wrong answer for $T=0.1$ (the correct answer is $5.44$, while I got $3.73$ ). I've tried to change the integral ...
4
votes
0answers
826 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 ...