Questions on numerical analysis/numerical methods; methods for approximately solving various problems that often do not admit exact solutions.
12
votes
6answers
3k views
Simple numerical methods for calculating the digits of Pi
Are there any simple methods for calculating the digits of Pi? Computers are able to calculate billions of digits, so there must be an algorithm for computing them. Is there a simple algorithm that ...
8
votes
3answers
2k views
Gradient Descent with constraints
In order to find the local minima of a scalar function $p(x), x\in \mathbb{R}^3$, I know we can use the gradient descent method:
$$x_{k+1}=x_k-\alpha_k \nabla_xp(x)$$
where $\alpha_k$ is the step size ...
4
votes
3answers
2k views
How to accurately calculate erf(x) with a computer?
I am looking for an accurate algorithm to calculate the error function. I have tried using this formula (Handbook of Mathematical Functions, formula 7.1.26), but the results are not accurate enough ...
4
votes
3answers
429 views
What is step by step logic of pinv (pseudoinverse)?
So we have a matrix $A$ size of $M \times N$ with elements $a_{i,j}$. What is a step by step algorithm that returns the Moore-Penrose inverse $A^+$ for a given $A$ (on level of ...
6
votes
1answer
749 views
Levin's u-transformation
Suppose I'm given a very slowly converging sequence $\sum_k a_k$. In the literature, the Levin u-transformation is mentioned as a good universal technique for convergence acceleration.
I have ...
31
votes
3answers
749 views
How much does symbolic integration mean to mathematics?
(Before reading, I apologize for my poor English ability.)
I have enjoyed calculating some symbolic integrals as a hobby, and this has been one of the main source of my interest towards the vast ...
7
votes
2answers
1k views
How to evaluate Riemann Zeta function
How do I evaluate this function for given $s$?
$$\zeta(s) = \sum_{n=1}^\infty \frac1{n^s} = \frac{1}{1^s} + \frac{1}{2^s} + \frac{1}{3^s} + \cdots$$
3
votes
2answers
1k views
Implementation of Monotone Cubic Interpolation
I'm in need to implement Monotone Cubic Interpolation for interpolate a sequence of points.
The information I have about the points are x,y and timestamp.
I'm much more an IT guy rather than a ...
5
votes
2answers
322 views
Accelerating Convergence of a Sequence
Suppose I had a monotonically increasing sequence $\{d_{n}\}$ which is also bounded above. The $d_{n}$'s satisfy a given recurrence, however computationally they tend very slowly to the limit. What ...
3
votes
6answers
2k views
Algorithm to compute Gamma function
The question is simple. I would like to implement the Gamma function in my calculator written in C; however, I have not been able to find an easy way to programmatically compute an approximation to ...
4
votes
2answers
264 views
Plotting graphs using numerical/mathematica method
From the author's equation 13, 14 We can write by inserting V''(A)=0,
Solving for R we get,
$$R= \frac{6^{D/4} \sqrt{D}}{\sqrt{-2^{1+\frac{D}{2}} 3^{D/2}+3 2^{1+D} A-3^{1+\frac{D}{2}} A^2}}$$
Now ...
4
votes
6answers
683 views
An alternative way to calculate $\log(x)$
How can I replace the $\log(x)$ function by simple math operators like $+,-,\div$, and $\times$?
I am writing a computer code and I must use $\log(x)$ in it. However, the technology I am using does ...
173
votes
6answers
5k views
“The Egg:” Bizarre behavior of the roots of a family of polynomials.
In this MO post, I ran into the following family of polynomials: $$f_n(x)=\sum_{m=0}^{n}\prod_{k=0}^{m-1}\frac{x^n-x^k}{x^m-x^k}.$$
In the context of the post, $x$ was a prime number, and $f_n(x)$ ...
22
votes
5answers
2k views
How do you calculate the decimal expansion of an irrational number?
Just curious, how do you calculate an irrational number? Take $\pi$ for example. Computers have calculated $\pi$ to the millionth digit and beyond. What formula/method do they use to figure this out? ...
18
votes
2answers
435 views
Calculating $\lim_{n\to\infty}\sqrt{n}\sin(\sin…(\sin(x)..)$
I was asked today by a friend to calculate a limit and I am having
trouble with the question.
Denote $\sin_{1}:=\sin$ and for $n>1$ define $\sin_{n}=\sin(\sin_{n-1})$.
Calculate ...
11
votes
1answer
819 views
Iterative refinement algorithm for computing exp(x) with arbitrary precision
I'm working on a multiple-precision library. I'd like to make it possible for users to ask for higher precision answers for results already computed at a fixed precision. My $\mathrm{sqrt}(x)$ can ...
13
votes
4answers
4k views
Determining whether a symmetric matrix is positive-definite (algorithm)
I'm trying to create a program, that will decompose a matrix using the Cholesky decomposition.
The decomposition itself isn't a difficult algorithm, but a matrix, to be eligible for Cholesky ...
4
votes
1answer
239 views
Series expansion for iterated function
I would like to find the MacLaurin expansion of an iterated function. Finding the first few terms is not hard, but it doesn't take long before Mathematica runs out of memory using the straightforward ...
4
votes
1answer
235 views
Approximating Lambert W for input below 0
As a small part of a much bigger project, I need to be able to approximate the numerical output of the Lambert W function. I have found decent approximations (good up to at least 4 decimal places), ...
2
votes
1answer
65 views
I would like a hint in order to prove that this matrix is positive definite
Let $a_{ij}$ be a real number for all $i,j\in\{1,...,n\}$. Consider the matrix below.
$$B=\begin{bmatrix}
\sum_{k=1}^n(a_{1k})^2 & \sum_{k=1}^na_{1k}a_{2k} & \cdots & ...
2
votes
2answers
264 views
Solving short trigo equation with sine - need some help!
From the relation $M=E-\epsilon\cdot\sin(E)$, I need to find the value of E, knowing the two other parameters. How should I go about this?
This is part of a computation which will be done quite a ...
1
vote
1answer
368 views
Variational formulation of Robin boundary value problem for Poisson equation in finite element methods
So I am confused about some details of obtaining a variational formulation specifically for Poisson's equation. I am in a Scientific Computing class and we just started discussing FEM for Poisson's ...
7
votes
1answer
232 views
PDE - Feynman-Kac vs. finite difference methods
I've heard that in greater than three dimensions, it's more efficient to solve a second-order parabolic PDE using a Monte-Carlo method based on the Feynman-Kac formula that it is to use finite ...
6
votes
2answers
532 views
How do you determine the closest whole number ratio for a given real number?
I've been messing around with formulas for musical notes (trying not to read anything that would help me unless I get stuck) and currently I'm at a point where I'm trying to get a function that ...
6
votes
1answer
82 views
Formula for straight part of a slightly bumpy line
Given a straight line that deviates from the horizontal by at most 15 degrees.
On this straight line there are bumps on top at random places on the line. The combined width of the bumps is at most ...
6
votes
3answers
495 views
Numerically estimate the limit of a function
Is there an algorithm that will allow me to numerically compute the limit of a function f(x) in a principled way?
The most naive algorithm would be to continue to compute the function for larger ...
5
votes
2answers
1k views
How can I calculate non-integer exponents?
I can calculate the result of $x^y$ provided that $y \in\mathbb{N}, x \neq 0$ using a simple recursive function:
$$
f(x,y) =
\begin {cases}
1 & y = 0 \\
(x)f(x, y-1) & y > 0
\end ...
3
votes
1answer
244 views
How do iterative methods applied to the companion matrix of a polynomial $p(\lambda)$ relate to $p$ itself?
A few days ago, I had a vague question in my mind about "matrix methods" for finding roots of a polynomial. Now I can ask at least a semi-precise question, thanks to the post
How to calculate complex ...
2
votes
1answer
188 views
butcher tableau runge kutta methods
Hi I have had a go at this question- am i heading in the right direction? it would be much appreciated if someone could me
Write the Butcher Tableau for the 1-stage $\theta$ method:
$$U^n ...
2
votes
1answer
203 views
Two-Point boundary value problem
To solve ${d^2y \over dx^2} =f(x)$, $0<x<1$ with $y(0)=\alpha, y(1) = \beta$. We can get a finite difference approximation by taking $$\frac{y_{j+1}-2y_j+y_{j-1}}{h^2} =f_j \\\Rightarrow ...