Questions tagged [quadratic]

Pertains to squares or squaring. Use this tag for questions relating to quadratic equations, quadratic regression, and similar concepts in the context of programming as defined in the Help Center. It may also be used for questions regarding quadratic probing and quadratic time complexity.

Quadratic means to the second (2nd) power, that means, squares (in algebra), or squaring. This tag is used for questions relating to quadratic equations, regression, and similar programming contexts involving quadratic polynomials or terms.

A quadratic polynomial is a polynomial of degree 2. All quadratic polynomials of a single variable x is of the form ax^2 + bx + c where the quadratic coefficient a != 0. The graph of a quadratic function is a parabola, with open end up if a > 0, and down if a < 0. All quadratic polynomials have exactly two complex roots, and can have either two, one, or zero real roots. The famous quadratic formula, applicable for all quadratic polynomials ax^2 + bx + c with real or complex coefficients a,b,c , is given by x = (-b ± sqrt(b^2 - 4*a*c)) / (2*a).

Here are the graphs of three quadratic functions with color coding

three quadratics

A quadratic regression is a method of finding a parabola, represented as a quadratic polynomial of best fit in a set of data. The chart below shows an example of finding a parabola extrapolating the known data points.

Source: https://www.varsitytutors.com/hotmath/hotmath_help/topics/quadratic-regression

Quadratic Complexity means complexity of O(n^2). That means, it grows similar to a positive quadratic function ax^2 + bx + c, a > 0 as x grows, precisely, f(x) == O(x^2) if f(x)/x^2 is constant. There are two forms of quadratic complexity: quadratic space and quadratic time, indicating that this program or algorithm asymptotically requires extra memory space or took time equal to the square of the size of the input n respectively. Selection sort is an example of a quadratic time algorithm. Linear or better complexity is also within quadratic complexity.

380 questions
7
votes
1 answer

Formulating quadratic equations in clpfd

CLPFD-systems are not primarily targeted to handle quadratic equations efficiently, nevertheless, are there better ways to formulate problems like the following? It seems the problem boils down to equations like the following. SWI with…
false
  • 10,182
  • 12
  • 93
  • 182
7
votes
2 answers

Dual Contouring and Quadratic Error Function

I've implemented marching cubes, dual marching cubes and adaptive marching cubes in C#, only to find out that I need dual contouring for my purposes. I've read all works about dual contouring and I get all but the core of the dual contouring itself:…
6
votes
3 answers

how to: solver foundation quadratic least squares

I have two independent variables, GSH and Gls. Using these two variables, I'm trying to predict an outcome, prob. Using a function of the form: prob=a*Gls^2+b*GSH^2+c*Gls+d*GSH+e // (where a,b,c,d,e are coefficients) Sample of data: Gls( 2.3 2.3…
6
votes
2 answers

QP solver for Java

I'm looking for a good easy to use Java based Quadratic Programming (QP) solver. Googling around I came across ojAlgo (http://ojalgo.org). However, I was wondering if there are any other/better alternatives.
dmcer
  • 8,016
  • 33
  • 41
5
votes
3 answers

Limit for quadratic probing a hash table

I was doing a program to compare the average and maximum accesses required for linear probing, quadratic probing and separate chaining in hash table. I had done the element insertion part for 3 cases. While finding the element from hash table, I…
Arun Babu
  • 259
  • 1
  • 4
  • 12
4
votes
2 answers

Quadratic regression line using R plotly

I am quite new to R and really new in plotly. I am trying to plot a quadratic (i.e. 2nd-degree polynomial) regression line. Once some prices vs years, and once the same prices vs a list of certain integer numbers (which can be the same), let's say…
Giannis K
  • 61
  • 5
4
votes
1 answer

quadratic optimization in R with both equality and inequality constraints

I'm trying to find how to solve quadratic problem in R with both equality and inequality constraints as well as with upper and lower bounds: min 0.5*x'*H*x + f'*x subject to: A*x <= b Aeq*x = beq LB <= x <= UB I've checked 'quadprog' and…
nevgeniev
  • 125
  • 7
4
votes
1 answer

ValueError: math domain error - Quadratic Equation (Python)

I'm very new to python programming and to this site. I'm currently working on a problem and can't seem to understand the error. import math # Problem number 5. A5 = 5 B5 = 0 C5 = 6.5 # Root1 x9 = (-B5 + math.sqrt(B5**2 - 4*A5*C5))/(2*A5) # Root2 x10…
4
votes
1 answer

Vowpal Wabbit Interaction Redundancy

I am curious about the way VW appears to create interaction terms, through the -q parameter. For the purpose of this illustration I am using this toy data, which is called cats.vm: 1 |a black |b small green |c numvar1:1.62 numvar2:342 |d cat |e…
B_Miner
  • 1,635
  • 1
  • 23
  • 54
4
votes
2 answers

Quadratic Time for 4-sum Implementation

Given an array with x elements, I must find four numbers that, when summed, equal zero. I also need to determine how many such sums exist. So the cubic time involves three nested iterators, so we just have to look up the last number (with binary…
Filuren
  • 631
  • 2
  • 7
  • 19
4
votes
1 answer

Quadratically constrainted quadratic programming (QCQP) in MATLAB

Recently I have run into a Quadratically constrainted quadratic programming (QCQP) problem in my research. I have found something useful in MATLAB optimization toolbox, i.e. 'fmincon' function (general nonlinear optimization with nonlinear…
ywang
  • 87
  • 2
  • 8
4
votes
2 answers

Using points to generate quadratic equation to interpolate data

I'm trying to come up with a flexible decaying score system for a game using quadratic curves. I could probably brute force my way through it but was wondering if anyone can help me come up with something flexible or maybe there are some ready made…
Tristan
  • 3,805
  • 4
  • 32
  • 57
4
votes
3 answers

Need help installing LAPACK/BLAS for CVXOPT (or a recommendation for another QP solver that's easier to install)

I've been trying to install CVXOPT, which requires LAPACK/BLAS and to be honest it's killing me! Context: I am experimenting with an SVM and so need a QP solver. CVXOPT seems to be the best. The problem is the LAPACK/BLAS (or ATLAS) dependency.…
iRoygbiv
  • 825
  • 2
  • 7
  • 21
3
votes
2 answers

Is there a matlab built-in that calculates the quadratic form (x'*A*x)?

Pretty straightforward question: Given an N x N symmetric matrix A and an N-vector x, is there a built-in Matlab function to calculate x'*A*x? i.e., instead of y = x'*A*x, is there a function quadraticform s.t. y = quadraticform(A, x)? Obviously I…
dantswain
  • 5,167
  • 1
  • 26
  • 35
3
votes
1 answer

Simple Multiplication and Arithmetic in C

I have an assignment to compute the roots of quadratic equations in C, should be pretty simple and I know what I need to do with the program but I am having a problem nonetheless. It works fine when the roots are imaginary and when the term inside…
none
  • 263
  • 6
  • 13
1
2
3
25 26