Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
126

Try to solve $x^{1/3} = 0$ with a "symbolic calculation". Now try to solve $x^{1/3} = 0$ with Newton's Method. The point is numerical methods can fail and anyone using numerical methods should have an understanding of mathematics so that they can detect when a numerical method is not working and perhaps even fix the problem. Also as this case shows sometimes ...


126

$x^2 = 2$ doesn't have a solution in the rationals. So what could you possibly mean by it having a numerical solution? Do you mean that you can produce a rational numbers whose squares are arbitrarily close to $2$? Congratulations: your notion of "having a numerical solution" is simply reinventing the notion of "real number", just in a form that is much ...


113

By the laws of logarithms $$ \log_2(256!) = \sum_{i=1}^{256} \log_2(i)$$ This is easily evaluated (albeit not on all calculators). In Python: >>> sum(math.log2(i) for i in range(1,257)) 1683.9962872242136


112

First, has anybody ever seen anything at all like this before? Yes, and in fact the interesting patterns that arise here are more than just a mathematical curiosity, they can be interpreted to have a physical context. Statistical Mechanics In a simple spin system, say the Ising model, a discrete set of points are arranged on a grid. In physics, we like ...


111

I think this calculation would have been doable in 1873, as follows: (1) Compute $\log \pi$ to $60$ digits. For this, we begin with the expansion $$\log \pi = \log \left(\frac{\pi}{22/7}\right)+\log 2 + \log 11-\log 7$$ and take full advantage of the fact that the logarithm tables of small integers were known to great precision. As for the logarithm of $...


78

$\lim_{n\to\infty} f_n(x)/n$ exists for $x$ in the open unit disc, and is equal to the partition generating function $P(x)$. Convergence is uniform on closed unit balls. To prove this, we use the following lemma: Let $a_{n,m}$ be a double sequence of numbers such that $a_m= \lim_{n\to \infty}a_{n,m}$ exists and $|a_{n,m}| \leq |a_m|$. Let $R$ be the ...


77

If there was no symbolic math, we would still be living in caves and eating roots. Formulas have meaning: $$F=m\cdot a$$ is enough to explain a great deal of the universe. Numbers are uninformative and unstructured: $$41.04=7.54\cdot5.443$$ tells you about nothing. Real numbers have been invented because they model very well our intuition of a continuum, ...


62

If it's about factorials, you can use Stirling's approximation: $$\ln(N!) \approx N\ln(N) - N$$ Due to the fact that $$N! \approx \sqrt{2\pi N}\ N^N\ e^{-N}$$ Error Bound Writing the "whole" Stirling series as $$\ln(n!)\approx n\ln(n)−n+\frac{1}{2}\ln(2\pi n)+\frac{1}{12n} −\frac{1}{360n^3}+\frac{1}{1260n^5}+\ldots $$ it is known that the error in ...


57

In addition to what others are saying: Many mathematical results, and even entire branches of math, can't be done numerically because they're about objects that are much more general than numbers. Group theory and topology spring to mind as examples.


55

In fact, you gave up too early ; The method eventually converges : 1 2.000000000000000000000000000 2 1.500000000000000000000000000 3 0.3333333333333333333333333333 4 2.148148148148148148148148148 5 1.637079608343976160068114091 6 0.9483928480399477528436835979 7 1.910874140183680201544963299 8 1.405089904362402921055022221 9 -1....


53

Analytical approach example: Find the root of $f(x)=x-5$. Analytical solution: $f(x)=x-5=0$, add $+5$ to both sides to get the answer $x=5$ Numerical solution: let's guess $x=1$: $f(1)=1-5=-4$. A negative number. Let's guess $x=6$: $f(6)=6-5=1$. A positive number. The answer must be between them. Let's try $x=\frac{6+1}{2}$: $f(\frac{7}{2})<0$ So it ...


51

The precise name for the feature is underflow, which means it's less than the smallest number the registers can hold. It's kind of like overflow.


51

Newton's method does not always converge. Its convergence theory is for "local" convergence which means you should start close to the root, where "close" is relative to the function you're dealing with. Far away from the root you can have highly nontrivial dynamics. One qualitative property is that, in the 1D case, you should not have an extremum between ...


50

In general, numerical methods don't constitute proofs. If all we have is an unknown blackbox function $f:\mathbb{R} \to \mathbb{R}$ that we know nothing about, and all we can do is compute its value at (finitely) many points, then we simply can't prove that $f$ is positive. However, in specific cases, we could have arguments based on numerical methods that ...


42

The paper "On the computation of the Euler constant $\gamma$" by Ekatharine A. Karatsuba, in Numerical Algorithms 24(2000) 83-97, has a lot to say about this. This link might work for you. In particular, the author shows that for $k\ge 1$, $$ \gamma= 1-\log k \sum_{r=1}^{12k+1} \frac{ (-1)^{r-1} k^{r+1}}{(r-1)!(r+1)} + \sum_{r=1}^{12k+1} \frac{ (-1)^{r-...


40

$\pi$ For computing $\pi$, many very convergent methods are known. Historically, popular methods include estimating $\arctan$ with its Taylor's series expansion and calculating $\pi/4$ using a Machin-like formula. A basic one would be $$\frac{\pi}{4} = 4 \arctan\frac{1}{5} - \arctan\frac{1}{239}$$ The reason these formulas are used over estimating $\...


40

Consider the polynomial, $$p_1(x)=(x-1)(x-2)...(x-19)(x-20).$$ After expanding it, you get, \begin{array}{|r|r|} \hline \textrm{Exponent} & \textrm{Coefficients of $p(x)$}\\\hline 0 & 2432902008176640000 \\ 1 & -8752948036761600000 \\ 2 & 13803759753640704000 \\ 3 & -12870931245150988800 \\ 4 & 8037811822645051776 \\ 5 & -...


37

A nicer(?) recursive scheme (for the polynomials, not yet for the roots) is the following. We initialize $f_0(x)$ and $f_1(x)$ with series constants (notation:Pari/GP): $f_0=\operatorname{Ser}(1) $ and $f_1 = \operatorname{Ser}(2)$. Then we proceed recursively: $$ \quad \begin{array} {rcll} f_0 & = & 1 \\ f_1 & = & 2 \\ \hline f_2 &...


37

There are many Runge–Kutta methods. The one you have described is (probably) the most popular and widely used one. I am not going to show you how to derive this particular method – instead I will derive the general formula for the explicit second-order Runge–Kutta methods and you can generalise the ideas. In what follows we will need the following Taylor ...


37

First, note that such a formula would violate the "too good to be true" test: it would let you find the minima of any (sufficiently smooth, strictly) convex function in a single step, no matter how complicated! For intuition, consider what Newton's method is doing: you are starting from an initial guess, and taking a sequence of "downhill steps" until you ...


36

This is a great question, and I like it especially since I'm a student of computational science and so spend my days around numerical software and approximations. Symbolic math exists for the same reason that not all physics, chemistry, biology, economy etc. can be reduced to one large computer program. We still need to think and reason about problems. ...


33

I think it would be appropriate at this point to quote Forman Acton: ...at a more difficult but less pernicious level we have the inefficiencies engendered by exact analytic integrations where a sensible approximation would give a simpler and more effective algorithm. Thus $$\begin{align*}\int_0^{0.3}\sin^8\theta\,\mathrm d\theta&=\left[\left(...


33

It really depends on the CPU. For intel IA64, apparently they use Taylor series combined with a table. More info can be found here: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.24.5177 and here: http://www.computer.org/csdl/proceedings/arith/1999/0116/00/01160004.pdf


33

With the spectral radius, you are on the right track. Let us write down what we have: $$ A = \left( \begin{array}{ccc} 1 & 2 & 3 \\ 2 & -1 & 2 \\ 3 & 1 & -2 \end{array} \right)$$ and (less important) $$b = \left( \begin{array}{c} 5 \\ 1 \\ -1 \end{array} \right)$$ So how do we formulate Gauss-Seidel? Note that there are different ...


33

The method is easiest to justify in one dimension. Say that I have some complicated function $f(x)$ whose root I want to find: "I don't know how to find its root; it's complicated!" Thus, we use a general idea that has always been used in the design of numerical methods: Replace a complicated function with a simple approximation. One of the simplest ...


33

I will outline the process and you can fill in the calculations. We have our system as: $$ \left\{\begin{array}{l} \frac{dy}{dx} = z \\ \frac{dz}{dx} = 6y - z \end{array}\right. $$ With $y(0)=3$ and $z(0)=1$. We must do the calculations in a certain order as there are dependencies between the numerical calculations. This order is: $k_0 = hf(x_i,y_i,...


33

Let $\cos^n$ denote the $n$-fold composition of the cosine function with itself, e.g. $$ \cos^3(\theta) = \cos(\cos(\cos(\theta))). $$ Note that this is not usually what this notation means in, for example, introductory calculus texts. However, it is convenient in the current context. What you are computing (assuming that it exists) is $$ \lim_{n\to\infty} ...


32

It doesn't. Your calculator can't handle a number of such a small magnitude. Specifically, $2^{-329}\approx 9.14\times 10^{-100}$, and I'm guessing that your calculator can only handle numbers of magnitude between $10^{-99}$ and $10^{99}$.


32

The other answers are great. I'd just like to add a concrete example of weird behavior of which the Ian's answer speaks. Let's consider a function $f(x) = \operatorname{sgn} x \sqrt{|x|}$. According to the algorithm, we iterate $$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}.$$ Now for the derivative (if we're not doing the derivative at $x = 0$, the $\...


32

It's easy to convert your integral into one without any singularities via the substitution $x=\sin\theta$: $$I=\int^{\pi/2}_0f(\sin\theta)\,d\theta.$$ If you're lucky to have a function $f$ that is even (so that $I$ is just a quarter of the integral over the full period, from $-\pi$ to $\pi$), you might be pleasantly surprised by the speed of convergence of ...


Only top voted, non community-wiki answers of a minimum length are eligible