Questions tagged [approximation]

A method of finding nearly-optimal solutions to a problem. Generally, this terminology is applied to algorithms and heuristics for solving NP-Hard problems in computer science.

Filter by
Sorted by
Tagged with
1 vote
0 answers
53 views

Finite volume method for a general flux

How to approximate flux 𝐹(𝑢)⋅𝑛 where 𝑛 denotes the unit normal outward when using finite volumes? in my case it's not a conservation law so my question is how can we approximate the final term \...
Chems Eddine's user avatar
0 votes
0 answers
56 views

How should I calculate the residuals of my numerical PDE solution?

I solved numerically the following wave equation with a source problem: $$ u_{rr} + {1 \over r}u_r + u_{zz} = {1 \over c^2}u_{tt} + s(r,z,t) \tag 1 $$ $$ u_r(0,z,t) = 0 \tag 2$$ $$ u_r(r_{max},z,t) = ...
Nikola Ristic's user avatar
1 vote
1 answer
159 views

How to approximate the flux when using finite volumes?

How to approximate flux $F(u)\cdot n$ where $n$ denotes the unit normal outward when using finite volumes? $$\int_{\sigma} F(u) \cdot \boldsymbol{n}_{K, \sigma} \mathrm{d} \gamma(x)$$
Chems Eddine's user avatar
3 votes
1 answer
162 views

How can we calculate mixed derivatives numerically using the Chebyshev derivative matrix?

Using the Chebyshev derivative matrix $D$, we can numerically approximate the first and second derivative of a function by doing matrix multiplication: $${df(x) \over dx} = Df(x) \tag 1$$ $${d^2f(x) \...
Nikola Ristic's user avatar
0 votes
0 answers
105 views

How can I plot Haar Wavelet Approximation in R?

I was trying to replicate the graphics in figure below using the package wavethresh in R. This figure can be found in the book: Wavelet Methods in Statistcs with R, G.P. Nason, pg. 30. The data used ...
Siqueira's user avatar
0 votes
0 answers
39 views

What is the minimum error achievable using gaussian process emulation?

I am interested in using Gaussian processes as emulators for other computational models, and I would like to characterize the expected numerical precision of the emulator. Specifically, how small can $...
user9794's user avatar
  • 465
1 vote
1 answer
108 views

in Finite Element, which approximation requires less number of unknowns: B-splines vs Shape functions vs Spectral Elements

In Finite Element Analysis, one requires to approximate the solution in terms of basis functions. My questions is, which method in general is better? by 'better', I mean which involves less number of ...
Hosein Javanmardi's user avatar
5 votes
1 answer
209 views

How to optimize an approximated matrix multiplication?

[UPDATING] The old one is a simplified version of the current one. Here is a solution based on the answer proposed by professor Bangerth down below. To describe what I am trying to do, first rewrite ...
Zuba Tupaki's user avatar
12 votes
2 answers
1k views

Faster Logistic Function

I've noticed that a fairly significant number of cycles in one of my programs are being consumed by the logistic function: $$f(x)=\frac{1}{1+e^{-x}}$$ Is there a good approximation I can use to reduce ...
Richard's user avatar
  • 3,961
1 vote
1 answer
446 views

Kolmogorov n-width

Could someone please point me to an understandable definition of the Kolmogorov n-width? I'm having a hard time figuring out what is the output of the definition - is it an integer? Edit: I realize ...
NNN's user avatar
  • 640
1 vote
1 answer
374 views

Finding the parameters of a function via curve fit

I'm trying to estimate the parameters (v, n, k) defined in fit_func. I tried the default least squares fit but I couldn't find the parameters successfully. ...
Natasha's user avatar
  • 421
0 votes
0 answers
505 views

Curve fitting using a piecewise polynomial

I am trying to fit a piecewise polynomial function Code: ...
Natasha's user avatar
  • 421
1 vote
0 answers
41 views

Integral from function approximations

I have some data which I cannot manage to model and fit with a known function, so let’s say that they are a sample from the unknow function $f(x)$, which look a sort of skewed bell-shaped distribution....
Stefano Barone's user avatar
2 votes
0 answers
56 views

Estimating $n$ column norms of $A$ by using less than $n$ calls to $Ax$?

Suppose I have an $m \times n$ matrix $A$ that is only accessible through matrix-vector products $Ax$. These are expensive, is there a way to approximate vector $x$ of $n$ column norms of $A$ by using ...
Yaroslav Bulatov's user avatar
3 votes
1 answer
85 views

Robust ways of evaluating $j_n(x+iy)/e^y$

For reasons to do with extending the range of applicability of this Mathematica package, I would like to have a good handle on the numerical evaluation of functions of the form $$ f(x) = \frac{j_n(\...
Emilio Pisanty's user avatar
9 votes
2 answers
522 views

Efficiently estimating trace of a product of matrices

I have $d\times d$ real-valued matrices $A_1,\ldots,A_k$, $1000<d<4000$, $k\approx 50$, and need to estimate the trace of the following matrix product $$t=\text{tr}(A_1 A_2\cdots A_k A_k^T \...
Yaroslav Bulatov's user avatar
6 votes
1 answer
232 views

General approach to infinite sums

My question is specific to algorithms and models of computation. I would like to write code to evaluate the following expression quickly and accurately: $$\log \left( \sum_{i=1}^{\infty}{I_{\nu+i}(2\...
Lewkrr's user avatar
  • 163
1 vote
0 answers
133 views

Fast evaluation of trigonometric polynomials

Suppose you have a trigonometric polynomial of the form \begin{equation*} x(t) = \sum_{k = 0}^N a_k \cos(2 \pi k f_0 t). \end{equation*} Using Clenshaw algorithm, one can evaluate this polynomial in $...
avril_14th's user avatar
1 vote
0 answers
68 views

elementwise function of low rank approximation

I recently ran into an interesting result. I have a matrix $D$ containing pairwise distances between all points in a dataset. This matrix is converted to a similarity matrix $S$ via an RBF kernel. ...
Thijs Steel's user avatar
  • 1,558
1 vote
1 answer
198 views

Improving function approximation with neural network

I am building a neural network to approximate a data set which takes 3 inputs and gives 1 output. After testing the network using a few different iterations of hidden layers and adjusting optimizers ...
Frosty's user avatar
  • 27
0 votes
0 answers
151 views

Boundary conditions for an FEM approximation of the Laplace operator

Using FEM, I want to approximate the Laplacian $$u = \nabla \cdot \nabla h \, ,$$ where $h(x,y)$ is an FEM approximated scalar field on the same mesh, i.e. piecewise differentiable. I am using MOOSE ...
pimpom's user avatar
  • 21
5 votes
1 answer
406 views

Floating point and global error in Euler Method

Inspired by this answer, I tried to understand when floating point errors come into visibility and to check it also comparing the plot of the numerical solution with Explicit Euler with the analytical ...
Vefhug's user avatar
  • 309
3 votes
1 answer
77 views

Is there a source/cookbook of equations that approximate geometric shapes?

I'm numerically modelling flows around various geometric 2D shapes. Is there a good source/cookbook of equations that approximate these? Some examples are Rectangle: $(x-a)^n+(y-b)^n < r^n$ where ...
Friasco's user avatar
  • 81
4 votes
0 answers
62 views

Continuous limit and nonlinear functional analysis

I have a kind of general question about approximation schemes in nonlinear functional analysis. Given a nonlinear map $\Phi$ from an open set (in an infinite dimensional Banach space) of functions to ...
picop's user avatar
  • 141
1 vote
0 answers
92 views

Error curve does not oscillate in between reference points using Remez

Using the Remez algorithm, implemented using multi-precision library, in certain functions that I want to approximate, the error curve does not oscillate in between reference points, and so no roots ...
Daniel's user avatar
  • 181
3 votes
1 answer
111 views

Linearization of Remez algorithm rational case

In the rational case, we are interested to find polynomials $P(x)$ and $Q(x)$ s.t. $f(x_k)-P(x_k)/Q(x_k)=(-1)^kE$ for $k=1,2,\ldots, N$ where $N=deg(P)+deg(Q)+2$ This can be rewritten as $$ (1)~~~~~~(...
Daniel's user avatar
  • 181
1 vote
1 answer
78 views

Questions on Daubechies wavelets

Is the refinement equation for the orthonormal Daubechies scaling function $$\phi(x) = \sqrt{2} \sum_n h_n \phi(2x-n) \;?$$ The filter coefficients for Daubechies wavelets have been given e.g. in this ...
tohoyn's user avatar
  • 331
3 votes
0 answers
202 views

Remez algorithm convergence

I have implemented the Remez algorithm in Python where all calculations were done with the Python mpmath library. I have noticed that sometimes the $|E_{max}|$ and $|E_{min}|$ do not monotonically ...
Daniel's user avatar
  • 181
3 votes
3 answers
630 views

What are some algorithms to calculate the width of an arbitrary polygon when a bounding box approximation is inaccurate

What are some alternative algorithms to creating a bounding box for finding the max width of a concave, simple winding polygon, like the one in the below image? I prefer solutions that are more ...
Addie's user avatar
  • 131
2 votes
1 answer
2k views

what is non-asymptotic convergence?

I guess convergence in general means it is in asymptotic sense but what does non-asymptotic convergence mean?. Can someone please explain with an example?
Kethan Chauhan's user avatar
2 votes
0 answers
36 views

Fast approximate evaluation of Fourier-Legendre series

Suppose I know that a function from $[0,\pi] \to \mathbb{R}$ may be written as $$ \sum_{k=0}^\infty A_l \frac{2l+1}{4\pi} P_l(r) $$ where $A_l$ all are known. Is there a way in which I may very ...
eja's user avatar
  • 21
0 votes
2 answers
326 views

How can I calculate the exponential integral?

(I originally asked this in a different exchange.) I'm writing a program that uses the prime-counting function. Right now, I'm using x/log(x), but I want to ...
CTMacUser's user avatar
  • 109
5 votes
1 answer
100 views

approximate function such that the inverse of the approximation is "simple"

I have a smooth enough injective function $f:[a, b]\to \mathbb{R}$ which I want to approximate by something that can be computed quickly, e.g., a Padé approximant of low degree, $$ \frac{\sum_{j=0}^m ...
Nico Schlömer's user avatar
4 votes
0 answers
97 views

Fast approximate solver for vehicle routing problem

I need to solve capacitated asymmetrical vehicle routing problem with time windows on ~30k points. Time limits for calculations are 2 hours. I've tried using Clarke and Wright savings algorithm, it is ...
Dimitrius's user avatar
  • 141
4 votes
0 answers
257 views

MATLAB: Compute the Schwarz-Christoffel transformation symbolically

Suppose we have a conformal mapping from the unit disk in the $\omega$ plane onto the exterior of a polygon in the $z$ plane. The Schwarz-Christoffel mapping in this case is defined as: $$f(u) = A - ...
Tony_V's user avatar
  • 73
8 votes
1 answer
323 views

Size of jump for piecewise discontinuous approximations

If one has a sufficiently smooth function $u$ that is approximated by a piecewise constant function $u_h=\Pi^0_h u$ on a mesh of cell size $h$ (where $\Pi^0_h$ is the $L_2$ projection onto the ...
Wolfgang Bangerth's user avatar
0 votes
1 answer
46 views

Slightly change two vectors to satisfy a constraint

$\vec{a}\cdot\vec{b} \approx c$ $\vec{\alpha} \cdot \vec{\beta} = c$ $\vec{\alpha}$ is close to $\vec{a}$ and $\vec{\beta}$ is close to $\vec{b}$ Given $\vec{a}$, $\vec{b}$ and c, how to find $\vec{\...
R zu's user avatar
  • 163
8 votes
1 answer
469 views

What algorithm does (or did?) Excel use for Bessel functions that is discontinuous at x=8?

Writing this comment reminded me of something I noticed years ago about evaluating Bessel functions of the first kind $J_n(x)$ in Excel. (BESSELJ) I don't use Excel now but at the time I'd checked ...
uhoh's user avatar
  • 1,038
2 votes
0 answers
72 views

Weighted Set Cover in practice, beyond the greedy algorithm

According to the wikipedia page for Set Cover, the greedy algorithm for weighted set cover achieves the polynomial-time approximation bound. There are other techniques for solving Set Cover, such as ...
Gus's user avatar
  • 251
1 vote
1 answer
189 views

Approximation of a non linear problem with python

I need your help to solve a problem I'm working on for school. My goal is to approximate the coefficients of a weight matrix so that they check particular properties. So I have $W$ the weight matrix ...
ElfamosoPepin's user avatar
3 votes
2 answers
298 views

Image hash similarity matching possible?

I have the following question: We have two face image files (JPEG), a Matrix of $128\times 128$ with values between 0-255. We would like to hash both image files using a function $f(x, key)$. Where I ...
zer02's user avatar
  • 131
4 votes
1 answer
201 views

Taylor expansion of error - Finite elements approximation

In some of my computations I calculate a scalar value $\lambda_h$ (in my case an eigenvalue) depending on a finite element discretization of the domain. Usually we can manage to find estimates of the ...
Beni Bogosel's user avatar
  • 1,035
0 votes
1 answer
96 views

Which are some good algorithms and heuristics to calculate the similarity between two matrices?

Say I have a matrix like this: \begin{bmatrix} 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 1 \\ 0 & 1 & 1 & 1 \\ \end{bmatrix} And this one: \begin{bmatrix} ...
Mikael's user avatar
  • 109
0 votes
1 answer
287 views

Linear Least-Squares Point-to-Plane ICP degenerative case

I'm trying to implement Linear Least-Squares Optimization for Point-to-Plane ICP Surface Registration Paper describes linear approximation for point to plane distance for rigid ICP. This approach is ...
Daiver's user avatar
  • 225
0 votes
1 answer
124 views

Chebychev Polynomial derivatives at zero points and extreme points

I was looking for some help with derivatives of Chebychev polynomials at zero points. The recursive expression, $$ T_{(j+1)}(x) = 2xT_j(x) - T_{(j-1)}(x) $$ has the derivative $$ T'_{j+1}(x) = 2T_j(...
Anup Mulay's user avatar
0 votes
1 answer
3k views

Derivatives of a Chebychev polynomial

I am using Chebychev collocation nodes for approximation, and my problem requires me to calculate derivatives of the polynomial. I have been reading from a few sources, but I am not sure I understand ...
Anup Mulay's user avatar
1 vote
0 answers
69 views

Computing dilogarithm

I'm measuring the integral of a quantity which, mathematically, requires the computation of a dilogarithm function. $$\operatorname{Li}_2(be^{ax})$$ where $b$ and $a$ (are real and) can be positive ...
Ali Abbasinasab's user avatar
0 votes
1 answer
308 views

B-Splines Matlab Package

I'm looking for a good Matlab package/library for B-Splines approximation. Ideally, it would take knots $t_1, \ldots , t_n$, and data points $g(t_1),\ldots , g(t_n)$, and Produce $$Vg :\,= \sum\...
Amir Sagiv's user avatar
4 votes
0 answers
91 views

Extrapolation after successive finite element refinement

I wish to compute a certain function $\lambda$ (in my case an eigenvalue of the Laplacian) to a certain accuracy, which I wish to guarantee, if possible. I started with a finite element method. I know ...
Beni Bogosel's user avatar
  • 1,035
4 votes
1 answer
989 views

Chebyshev approximation by projection vs interpolation

Suppose we want to approximate a function $f: [a, b] \rightarrow \Re$ with a Chebyshev series: $$ f(x) \approx \sum_{k=0}^n c_k \, T_k\left( \frac{2x-b-a}{b-a} \right) $$ where $T_k(x) = \cos(k\, \...
visitor's user avatar
  • 161