8 votes

Polynomial approximation

$\mathbf{A}$ is an $(n+1) \times (n+1)$ matrix. It can be obtained as follows: $\textbf{A} = \left[ \matrix{1 & 1 & 1 & \cdots & 1 \cr x_0 & x_1 & x_2 & \...
user avatar
  • 2,139
8 votes
Accepted

Reverse-engineering a quadratic fit?

My first guess was that they computed a minimax best-approximation polynomial to $\sqrt{x}$ on [0,5,1] with something like the Remez algorithm. However, plotting the difference $p(x)-\sqrt{x}$ I do ...
user avatar
7 votes

Seeking a free symbolic regression software

I wrote a Python package called PyPGE. PyPGE is a Symbolic Regression implementation based on Prioritized Grammar Enumeration (1), not Evolutionary or Genetic Programming. It produces a deterministic ...
user avatar
  • 179
7 votes
Accepted

Clever ways to update LU factorization for ridge regression

What is the size of your $A$ matrix? Is $A$ sparse? Does $A$ have some other special structure? How many values of $\lambda$ do you want to try? Normally, you'd use the Cholesky factorization of $...
user avatar
6 votes
Accepted

Finding rate of convergence by curve fitting in Matlab

First of all, rates of convergence are usually given in the form $$ \|u-u_h\| \leq C N^\alpha,$$ rather than equality. Furthermore, rates are asymptotic, i.e., only have to hold for $N\to \infty$. ...
user avatar
6 votes
Accepted

Fitting Implicit Surfaces to Oriented Point Sets

I was surprised for not receiving a satisfactory answer to the question above and my investigations showed me that this, indeed is an unexplored area. Hence, I put some effort in developing solutions ...
user avatar
  • 2,139
5 votes

Curve fitting for oscillating data

Numerical judgement of model choice: You model 36 observations with a model consisting of 12 or 13 predictor variables. This is most likely not a good model. Even if you reach a high $R^2_{adj}$, you ...
user avatar
5 votes

Finding parameters numerically

In general, you can formulate this as a nonlinear least squares problem. If your values are known at points $(x_{i},y_{i})$, and the known values are $f_{i}$, then you can minimize $\min_{a,b,c,d,e} ...
user avatar
5 votes
Accepted

What equation should I fit this set of data points to?

You could either fit a logistic function (possibly composing it with a linear function), use segmented regression, or classification and regression trees, among other options. The original data, ...
user avatar
4 votes

Seeking a free symbolic regression software

I once started writing anopen source version of Eureqa in Java. The project has limited capabilities but it implements the fitness function described in [1] and couple optimizations mentioned by the ...
user avatar
4 votes

Seeking a free symbolic regression software

After a cursory google search on the subject, it appears that "symbolic regression" is a problem that lends itself greatly to stochastic optimization algorithms like genetic programming (GP). It is ...
user avatar
  • 11.8k
4 votes

Problems Implementing the Remez Algorithm

Let's use the example (approximate the square root function on $[0.25,1.0]$ with a quartic polynomial) to step through your calculations. I suspect that the code is going to work with only modest ...
user avatar
  • 3,189
4 votes
Accepted

Polynomial approximation

You can easily do this with for loops. Just use n to define your loop limits. Here's a fully functional solution for MATLAB (just define n and x first): ...
user avatar
4 votes
Accepted

Finding a best fit line for the upper bound on an $x$ vs $y$ relationship

We can formulate the task of finding a straight line bounding the cloud of data points as constructing a straight line that touches the data set at least at two points, and the rest of the data points ...
user avatar
3 votes
Accepted

For finding the track of an object through space(3d) over time, what is the correct slope equation to use in the algorithm?

Given you are trying to find a path $f(t) = a + b t$ for each 3D component of an object to define its trajectory, you can formulate a Least Square problem to find the values for $a$ and $b$ based on $...
user avatar
  • 3,673
3 votes
Accepted

Constrained linear least squares matrix equation

This is a constrained minimization problem (with linear constraints). You can write it like $$\min_X \frac{1}{2}\|AX-B\|^2_2 \quad \text{ s.t. } e^TX = 1$$ where $e$ is the vector of all ones. ...
user avatar
  • 2,961
3 votes
Accepted

How do I correctly multiply vectors and matrices in Python and MATLAB?

David Ketcheson has already indicated the problem in his comment. I will flesh it out here. Note the form of the argument of the log in the logistic regression objective: $log[1+exp(−b_iA^T_ix)]$ ...
user avatar
  • 656
3 votes

Seeking a free symbolic regression software

I found the gramEvol R package flexible and easy to use. They have a small tutorial in which they rederive Kepler's third law from data. Note that it relies on Genetic Programmic for its optimisation ...
user avatar
3 votes

What equation should I fit this set of data points to?

An assortment of curves for fitting chemistry examples is presented in these Colby College class notes. Of particular application is the sigmoid response curve with variable "slope" for the central ...
user avatar
  • 3,189
3 votes

How can we solve the normal equations with limited memory?

That might also have been a trick question. Let's say you want to solve the normal equations for $Ax=b$, i.e., $(A^T A) x = A^T b$. Let's assume for a moment that the questioner meant that $A$ is ...
user avatar
3 votes

Reverse-engineering a quadratic fit?

If my computer history is not wrong, no one would use the initial guess obtained from the quadratic polynomial you provided and use the algorithm you suggested. This is due to two reasons: floating-...
user avatar
3 votes

Reverse-engineering a quadratic fit?

This polynomial $p(x)$ solves the minimax optimization for $$\frac{p(x)}{\sqrt{x}}-1$$ over the interval $[\tfrac12,1]$.
user avatar
  • 131
2 votes
Accepted

Least Angle when $\textbf{A}^T\textbf{A}$ is singular

Minimizing the 2-norm of $x$ among all least squares solutions is relatively easy to do- this is the pseudoinverse solution. It can be computed using either a rank revealing version of the QR ...
user avatar
2 votes

Seeking a free symbolic regression software

There is also a package for R called rgp. Visit this link. https://cran.r-project.org/web/packages/rgp/index.html I have not used rgp as I have only begun to use R seriously but it seemed like a ...
user avatar
  • 21
2 votes

What are good parametrizations of rational functions for response surface models?

What are good parametrizations of rational functions for response surface models? A widely used flexible parametrization of (piecewise) rational functions are non-uniform rational basis spline (NURBS)...
user avatar
2 votes

Fitting 2D mapping data from multiple measurements

If you know that you have $n$ points $X_1,...,X_n$ and the desired pairwise distances $d_{ij}$ between $X_i$ and $X_j$ you could try and optimize the functional $$ \sum_{i<j} (d_{ij}-|X_i-X_j|)^2$$ ...
user avatar
2 votes
Accepted

Correct weighting in least squares fitting

So the correct way is to use the probability distribution of your $c$ in the modeling process. Imho, the most natural way of describing and solving this type of problem is the Bayesian approach $$P(...
user avatar
  • 1,285
2 votes

Fitting line to a staircase function

You could use the floor function $$n(E) = \lfloor a + b E\rfloor\, .$$ Following is an example with $a=5$ and $b=3$. ...
user avatar
  • 7,902
2 votes

SciPy ODR "Ordinary" Least Squares?

Based on the ODRPACK Documentation it seems clear that by "ordinary least squares", the authors mean least squares in which the errors are (considered to be) only in the dependent variables, ...
user avatar

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