Tagged Questions

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

learn more… | top users | synonyms (1)

2
votes
2answers
82 views

Forcing RecurrenceTable + NIntegrate to evaluate lazily

I have a recurrence relation that grows exponentially if expressed in closed-form. I need to integrate this function. If I plot it, I think Mathematica evaluates the recurrence numerically at every ...
2
votes
2answers
274 views

Can Mathematica identify formulae or sequences of numbers?

Can Mathematica suggest what a formula means? For example if I input $$\sum_{i=0}^n i$$ can it infer that this is a sum of integer values from $0$ to $n$? Or if I enter $0,1,1,2,3,5,8,13$, can ...
4
votes
3answers
277 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 ...
2
votes
1answer
81 views

Convert Integer to Numeric with Replacement rules

I have a long list of triples, each looking something like {AGO, 1988, 2345.23}. Some of these, however, have an integer in the third spot, like this: ...
1
vote
0answers
396 views

DSolve 2nd Order Coupled Partial Differential Equations

I am trying to use Mathematica to solve 2 coupled differential equations. My equations are of the form \begin{equation}\ddot{x}_i + A_{il} \partial^l A^{jk} ( \dot{x}_b \dot{x}_c - y_b y_c ) =0 ...
8
votes
4answers
317 views

Numerical instability in cosh and sinh - integral functions [duplicate]

I'm trying to calculate the function: CoshIntegral[x] Sinh[x] - Cosh[x] SinhIntegral[x] Unfortunately Mathematica seems to hit a point (x~20) and things become ...
6
votes
3answers
263 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²] ...
1
vote
1answer
153 views

NSolve with numerical function

I would like to solve numerically an equation which involves a numerical function constructed by fitting some data: ...
6
votes
1answer
126 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: ...
7
votes
1answer
655 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
149 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 ...
5
votes
1answer
414 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
98 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
65 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
389 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. ...
2
votes
1answer
177 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
247 views
2
votes
4answers
185 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
150 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
88 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
140 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?
6
votes
2answers
321 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: ...
5
votes
4answers
351 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
199 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
146 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) ...
7
votes
1answer
343 views
0
votes
0answers
105 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
393 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
106 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}] ...
2
votes
1answer
242 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 ...
1
vote
3answers
327 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: ...
1
vote
3answers
473 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 ...
0
votes
0answers
132 views
12
votes
1answer
867 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 $$ $$ ...
3
votes
3answers
622 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 ...
7
votes
1answer
89 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 ...
6
votes
3answers
269 views
5
votes
1answer
557 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
0answers
261 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 ...
4
votes
2answers
251 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 ...
1
vote
0answers
45 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
105 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$ ...
9
votes
1answer
381 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
4answers
343 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 ...
1
vote
1answer
164 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 ...
8
votes
1answer
154 views

Exp of big negative numbers [duplicate]

I noticed that Exp have a strange behaviour with big negative numbers ...
2
votes
1answer
248 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 ...
1
vote
1answer
172 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
227 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)]] = ...