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
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 ...


20

$\log(n+1)-\log n=\log(1+\frac1n)$. Using the Taylor series for $\log(1+x)$, this is $$\frac1n-\frac1{2n^2}+\frac1{3n^3}-\cdots\approx\frac1n.$$


16

Especially Lime's answer is absolutely correct and a very good approach. Let me show a conceptually somewhat simpler one, that only uses the derivative, namely $(\log x)'=1/x$. This is a strictly decreasing function, so $\log x$ is concave. In particular, its graph is below the tangent line at any point of the graph. We obtain $\log (n+1)< \log n + 1/n$...


15

The bisection method only cares if the function changes sign, so it goes straight past the 'fake' root without noticing. If the coefficients have a slight error in them, then perhaps the 'fake' root should have been a root.


13

Well, is it proven or is it not proven? The way you've phrased your question is "if I've proven something with numerical methods, have I proven it?". Well, yes - you just said you had. Say you want to prove that $f(n)$ is a prime number for $n<10^7$. Well then if you loop through all the numbers less than $10^7$ and check that $f(n)$ is prime for all of ...


10

You have already found the value of $\log(2)$. Congrats! Hint: $$\int_0^1\frac{\mathrm{d}x}{1+x}=\log(2)$$ So there you have your context and what you have found is the value of the integration i.e. $\log(2)$ by using numerical methods (Trapezoidal rule).


9

This is rather similar to previous answers, but I think it's still worth pointing out. You're asking about the slope of a chord of the graph of $\log x$, the chord joining $(n,\log n)$ to $(n+1,\log(n+1))$. By the mean value theorem, this equals the slope of the tangent line, $1/x$, at some $x$ between $n$ and $n+1$.


9

You have to be aware that the bisection method finds a point with a sign change in the values of the numerical evaluation of your function. Due to catastrophic cancellation this can give wide errors even for simple roots. Take for instance the rescaled Wilkinson polynomial $p(x)=\prod_{k=1}^{20}(x-k/10)$ in double floating point precision, after multiplying ...


9

If we can show that the value of $A$ changes the amount of maxima or minima from 1 to 2 such that one extreme is at a positive $y$-location and the other at a zero or negative $y$-location, then we know that this value of $A$ is the border for all real solutions versus 1 real and 2 complex solutions. Denote $f(x) = x^3 + Ax^2 + 1.$ $$f'(x) = 3x^2+2Ax=x(3x+...


9

Let us consider the equation $v_t = \frac{1}{2-x^2-y^2} (v_{xx}+v_{yy})$ with initial and boundary conditions $$v|_{t=0} = e^{-(x^2+y^2)/2}, \quad v|_{y=\pm1/2} = e^{-(t+x^2/2+1/8)}, \quad v|_{x=\pm1/2} = e^{-(t+y^2/2+1/8)}.$$ For the Crank-Nicolson part, we implement the scheme $$ \frac{v_{i,j}^{n+1} - v_{i,j}^n}{k} = \frac{1}{2-{x_i}^2-{y_j}^2} \frac{1}{2 ...


8

Just added for your curiosity. In the same spirit as in other answers, instead of Taylor series, you could consider Padé approximants and get things such as $$\log(n+1)-\log n=\log\left(1+\frac1n\right) \approx \frac{2}{2 n+1}$$ $$\log(n+1)-\log n=\log\left(1+\frac1n\right) \approx \frac{6 n+3}{6 n^2+6n+1}$$ $$\log(n+1)-\log n=\log\left(1+\frac1n\right) \...


8

It's saddening to read such a question from an "aspiring $\ldots$ scientist" (according to his profile). Why should we do trigonometry, or some other kind of geometry, if we can measure lengths or angles with any desired precision using a yardstick or a protractor? Aren't you aware that the "praised PDE researchers" dig up universal truths, valid for all ...


7

$$\int_a^b \frac{1}{1+x}dx=\log_e(1+x)|_a^b=\log_e(1+b) - \log_e(1+a)=\log_e\frac{1+b}{1+a}$$ For $a=0$ and $b=1$ this goes to $\log_e2$ That's my answer. But ... if you want to know why $\int_a^b \frac{1}{1+x}dx=\log_e(1+x)|_a^b$ then here is the answer to that question. We kind of have to work backwards, so let's start with: $$y=\log_e(1+x)$$ Using ...


7

You could simply translate horizontally by $1$ to the right: $\frac{1}{1+x}$ looks the same between $0$ and $1$ than $\frac{1}{x}$ between $1$ and $2$. So: $$\int_0^1\frac{\mathrm{d}x}{1+x}=\int_1^2\frac{\mathrm{d}x}{x}$$ Which is $\log(2)$ by definition.


7

For the case of $v_t +v_x = 0$, the time step is related to the mesh size via a fixed value of the Courant number $\Delta t/\Delta x$. Therefore, error is analyzed in terms of the mesh size only. As specified in the comments, people like to use powers of two for the number of points $N$. This gives the following type of error plot: The $x$-axis is the mesh ...


7

In the $QR$-decomposition, $Q$ is an orthogonal matrix. One property of these matrices is that they don't change the length of vectors (in the 2 norm). Thus, we have that $$\Vert Ax - b \Vert = \Vert QRx - b \Vert = \Vert Rx - Q^{-1}b \Vert.$$ In this way, we can reduce the problem of least squares to the case where we have an upper triangular matrix $R$.


7

The most straightforward way I know is to pass through the normal equations: $$A^T A x = A^T b$$ and substitute in the $QR$ decomposition of $A$ (with the convention $Q \in \mathbb{R}^{m \times n},R \in \mathbb{R}^{n \times n}$). Thus you get $$R^T Q^T Q R x = R^T Q^T b.$$ But $Q^T Q=I_n$. (Note that in this convention $Q$ isn't an orthogonal matrix, so ...


7

To perform collocation, we introduce the regular discretization $t_i = i/n$ with $0\leq i\leq n$ of the domain $[0,1]$ (i.e., a set of $n+1$ collocation points). Then, we approximate $u$ by the polynomial function $p(t) = \sum a_k t^k$ of degree $n$ which satisfies the above problem at the collocation points. Therefore, $-p''(t_i) = 1 + \exp\!\big(p(t_i)\big)...


7

Let us plot the characteristic curves deduced from the method of characteristics. The latter are lines in the $x$-$t$ plane, along which $v$ is constant: One observes that the curves intersect at the breaking time $t_b = -1/\inf v_x(x,0) = 1$. Before the breaking time, $0 \leq t < 1$, the solution deduced from the method of characteristics reads $$ v(x,t)...


6

The Euler-Maclaurin Formula says $$ \sum_{k=1}^n\frac1k=\log(n)+\gamma+\frac1{2n}-\frac1{12n^2}+\frac1{120n^4}-\frac1{252n^6}+\frac1{240n^8}\color{#C00}{-\frac1{132n^{10}}}+\dots $$ If we use $n=10$ and the expansion with and without the red term, we get that $$ 0.5772156649008\le\gamma\le0.5772156649016 $$ Thus, to $10$ places we get $$ \gamma=0.5772156649 $...


6

Given your comment that you want the upper bound to be the integer closest to $0.9\over x$, the problem can be stated as finding $x$ such that $$\sum_{n=0}^{a(x)} (1-nx) = 45,$$ where $a(x)=\left[{0.9\over x}\right]$ and $[.]$ is the nearest integer function. Now $$\begin{align}\sum_{n=0}^a (1-nx) &= \sum_{n=0}^a 1- \sum_{n=0}^a nx\\ &=\sum_{n=0}^a ...


6

You want to compute $$ e_1^TL^{-T}D^{-1}L^{-1}e_1=(L^{-1}e_1)^TD^{-1}(L^{-1}e_1) $$ which means you have to solve the lower left triangular system $Lv=e_1$ and then compute $v^TD^{-1}v=\sum d_k^{-1}v_k^2$.


6

For $v_t+v_x=1$, the solution to the Cauchy problem $v(x,0)=F(x)$ obtained with the method of characteristics is $$ v(x,t) = F(x-t) +t . $$ The Lax-Friedrichs method reads $$ \frac{v_i^{n+1}-\frac{1}{2}(v_{i-1}^{n}+v_{i+1}^{n})}{\Delta t} + \frac{v_{i+1}^{n}-v_{i-1}^{n}}{2 \Delta x} = 1 $$ where $v_i^n \simeq v(i\Delta x, n\Delta t)$. This method is stable ...


6

The polynomial can be determined for instance with the code (in octave, there might be slight differences for matlab). First define a function that takes a coefficient array and returns an array containing the boundary conditions and the ODE residuals at the collocation points. function f = system(c) % degree of the interpolating polynomial % is also ...


6

The eigenvalues of a matrix and its similarity transform are the same, so the eigenvalues of $A$ and $B$ are the same. Next, for every $j=1,2,\ldots,n$, define a symmetric matrix $E^{(j)}=(B-b_{jj}I)e_je_j^T+e_je_j^T(B-b_{jj}I)$, where $e_j$ is $j^\text{th}$ standard basis vector. We have \begin{equation} (B-E^{(j)})e_j= Be_j - (B-b_{jj}I)e_j+e_je_j^T(B-b_{...


6

The equation of a circle through $A$, $B$, $C$ is given by: $$\left|\begin{array}{cccc} x^2+y^2 & x & y & 1 \\ A_x^2+A_y^2 & A_x & A_y & 1 \\ B_x^2+B_y^2 & B_x & B_y & 1 \\ C_x^2+C_y^2 & C_x & C_y & 1 \end{array}\right| = 0 \tag{1}$$ For $$A = \left(p,\frac{1}{1-p}\right)\qquad B = \left(\frac{1}{1-p},\frac{p-...


5

Try some trivial test cases, like $$ A=\pmatrix{1&0\\0&0}\implies A(A+\zeta I)^{-1}=\pmatrix{(1+ζ)^{-1}&0\\0&0} $$ which is nowhere close to the identity matrix.


5

Here's a geometric way to get a good approximation for $\ln(n+1)-\ln(n)$: Use the fact that $\ln(x)=\int_1^x \frac1t dt$. (For $x>0$.) Then $\ln(n+1)-\ln(n)$ is the area under the curve $f(x)=\frac1x$ from $n$ to $n+1$. We are looking for the area over an interval of length $1$. So numerically the area should be equal to the 'average' height. ...


5

This question is very broad, and its answers subjective (how do you quantify usefulness?), but I can give some comments. 1. Asymptotic convergence is not broadly guaranteed a priori. When solving an elliptic PDE using the finite element method, there are well-established results such as the Lax-Milgram theorem and Cea's lemma that furnish straightforward "...


5

Define some new variables $$\eqalign{ A &= \tfrac{1}{2}(P+P^T), \,\,\,\,\,B = \tfrac{1}{2}(Q+Q^T), \,\,\,\,\,M = B^{-1}A \cr \alpha &= {\rm tr}(X^TAX) \implies d\alpha=2AX:dX \cr \beta &= {\rm tr}(X^TBX) \implies d\beta=2BX:dX \cr }$$ Write your function in terms of these new variables, then find the differential and gradient. $$\eqalign{ C(X)...


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