Tag Info

Hot answers tagged

6

The remainder for an alternating series is given by $$|R_k| \le b_{k+1}.$$ This means you are looking for a $k$ for which $$\frac{1}{2(k+1)+1} < \frac{1}{2\cdot 10^8}.$$ This tells us that the $k$ we are looking for is greater than $$10^8 - \frac{3}{2}$$ which is fairly large. It would be impractical to actually compute $\pi$ with this series. ...


5

Bhaskara's sine approximation looks a bit like a Padé approximant and is eerily accurate. Another option---since you need to do this trillions of times---is to save the solutions for many values of $a$, and then look up/interpolate solutions as you need them.


4

Newton-Cotes says "pick evenly spaced points in the interval, draw the interpolating polynomial of minimal degree through them, and integrate the polynomial." From the Lagrange interpolation theorem, a Newton-Cotes rule on $n$ nodes is exact for polynomials of degree at most $n-1$. It is not exact for polynomials of any higher degree, because one can add a ...


3

There are two problems involved here: One, is a general local root finding problem, for which many method's (such as Newton's) can be used. The second, is the problem of finding all (at most three) solutions. One method I could suggest is the "Homotopy Continuation Method". To use it, first find all three solutions for some $a> e^e\sim15.15$. Now, vary ...


2

You're confusing two things: the set of solutions to the normal equations, and the set of vectors over which you are searching for the least squared error. The second set is just the set of all vectors $x$ in whatever vector space you're working on. The squared error varies as you choose different vectors from the second set. The goal of the least squares ...


2

I think you can use Gaussian quadrature with weight functions $w(x)=\sin(p_m)$ and $w(x)=\cos(p_m)$. For any weight function there is a family of orthogonal polynomials related to that function in $[a,b]$. This family can be obtained by Gram-Schmidt orthogonalization process on $1,x,x^2,\ldots,x^n$. Let $w(x)$ be a weight function in $[a,b]$ and ...


2

Let $u = \begin{bmatrix} x \\ x'\end{bmatrix}$. Then, $u' = \begin{bmatrix} x' \\ x''\end{bmatrix} = \begin{bmatrix} x' \\ x^2\end{bmatrix}$ with $u(0) = \begin{bmatrix} 0 \\ 1\end{bmatrix}$. So, taking forward Euler steps yields: $u(h) \approx u(0) + hu'(0) = \begin{bmatrix} 0 \\ 1\end{bmatrix} + h\begin{bmatrix} 1 \\ 0^2\end{bmatrix} = \begin{bmatrix} ...


1

A start: We have $x_n=e_n+1/2$. Substituting in the recurrence we obtain $$e_k+1/2=2(e_{k-1}+1/2)(1/2-e_{k-1}),$$ which simplifies to $$e_k =-2e_{k-1}^2.$$ Initially, $|e_0|\le \frac{1}{4}$. Thus $|e_1|\le \frac{1}{2}|e_0|$, and in particular $x_1$ remains in the interval $D$. But then $|e_2|\le \frac{1}{2}|e_1|$, and so $x_2$ remains in $D$. In general ...


1

For numerical quadrature, in general, the integral is approximated as a weighted sum of function values: $$\int_{a}^{b}f(x)\,dx \approx \sum_{k=1}^{n}w_kf(x_k).$$ If the absolute global error satifies the following as $n \rightarrow \infty$ $$\left|\int_{a}^{b}f(x)\,dx - \sum_{k=1}^{n}w_kf(x_k)\right|=O(n^{-p})$$ then the error is of order $p$. ...


1

Your first guess is $x_0=a$ and $f(a)<0$. Because $f$ is convex $$\frac{f(x_1)-f(a)}{x_1-a}< \frac{f(b)-f(a)}{b-a}.$$ With this you can prove $f(x_1)<0$ and $x_1 < \xi$. Note that $$f(x_1) < f(a) + \frac{x_1-a}{b-a}[f(b)-f(a)]= f(a)-\frac{f(a)}{f(b)-f(a)}[f(b)-f(a)]=0$$ On each subsequent iteration you start with $f(x_i) <0$ and ...


1

If you can do this in time $O(f(n))$, then you can factor semiprimes (i.e., $n$ of the form $pq$, where $p$ and $q$ are both primes) in time $O(f(n)\log n)$. To see this, note that if $n=pq$ (with $p<q$), then for all $b<p$, the number of divisors of $n$ less than or equal to $b$ is odd (just $1$), whereas if $p\leq b < \sqrt{n}$, then the number of ...


1

A cubic spline does the job: There are infinitely many programs for spline interpolation. I rolled my own, however (in Scilab). It computes cubic spline by considering it as a "correction" to piecewise linear interpolation. a = 0 b = 20 y = [0 1.8 2 4 4 6 4 3.6 3.4 2.8 0] n = length(y)-1 h = (b-a)/n jumps = diff(y,2)/h A = ...


1

If preserving the eigenvalues is necessary, then what you want to do is impossible. Take for instance the $\left\|\cdot \right\|_{2}$ norm, where it is easily shown that \begin{align} \mathrm{cond}_{2}(A) = \frac{|\lambda_{\max}|}{|\lambda_{\min}|} \end{align} From this we can see that the only way to reduce the condition number is to reduce ...


1

$$\frac{T_i^{n+1}-T_i^n}{\Delta t} = \alpha\frac{T_{i+1}^n-2T_i^n+T_{i-1}^n}{\Delta x^2}$$ Starting with the above and collect terms as you did $$ T_i^{n+1} = T_i^n(1-\omega) + \omega(0.5T_{i+1}^n + 0.5T_{i-1}^n) $$ we use a plane wave solution for the stability of $T_i^n = T_0\mathrm{e}^{at+ikx}$ leads to $$ T_0\mathrm{e}^{a(t + \Delta t)+ikx} = ...


1

The reason that they don't set $x$ is because it's the variable that you'll use to interpolate between your known $x_j$ and $x_{j+1}$. In other words, the point is to calculate the coefficients of your spline, and then run something like this: // First compute spline coefficients using the given points (x[j],y[j]). // (i.e., compute all the a[j], b[j], ...


1

Based on the comments, this is probably what you're supposed to do. To transform $A$ to the upper triangular form requires an application of two Householder transformations. Take $$ Q_1=I-2\frac{v_1v_1^T}{v_1^Tv_1}\quad\text{with}\quad v_1=[3,1,1,1]^T. $$ This gives $$ Q_1^TA=\begin{bmatrix} -2 & -3 \\ 0 & -4/3 \\ 0 & -1/3 \\ 0 & 8/3 ...



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