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.

420 questions
0
votes
1 answer

How to insert random ints into hashing table?

The data structure & algorithm class that I'm taking now is a lot of pen and paper understanding of how algorithms work, but very little actual coding. I'm kind of a programming noob, so this may be a stupid question to some of you. Conceptually, I…
Jackson F
  • 48
  • 1
  • 6
0
votes
1 answer

Quadratic Formula Failing when A > 1?

I am in the process of developing my first app which solves the quadratic formula and I have run into a problem that the app gives the wrong answers for the roots when the value fo a is greater than 1. This is the code: package…
0
votes
1 answer

Programming C if statements

#include #include int main (void){ double a,b,c, x, y, z1, z2; printf("Enter the coefficients of a polynomial(ax^2+bx+c):…
Beginner Programmer
  • 167
  • 1
  • 2
  • 11
0
votes
2 answers

Solve non-linear system in C++

I am fairly proficient at both math and C++ and can do the following with ease in Matlab. I was just wondering how i would go about implementing this in C++ as i have little knowledge of library availability or other approaches to the problem: I…
TimZaman
  • 2,689
  • 2
  • 26
  • 36
0
votes
3 answers

Solve maximization problem of quadratic equation in MATLAB

How do I solve a quadratic Maximization problem in MATLAB? It seems MATLAB only supports minimization problems, so is there a mathematical concept I can use?
0
votes
1 answer

R quadratic multi dimensional optimization with constraints

I am tryinig to solve the quadratic optimization of the following function: b<-4.7e-09 a<-(-2e-05) M<-100 beta<-0.5 min<-fuction(x){ x1=x[1] x2=x[2] x3=x[3] E=a*x1+b*x1^2+a*x2+b*x2^2+a*x3+b*x3^2 V=(M-x1)+(M-x1-x2)+(M-x1-x2-x3) …
0
votes
1 answer

univariate nonlinear optimization with quadratic constraint in R

I have a quadratic function f where, f = function (x) {2+.1*x+.23*(x*x)}. Let's say I have another quadratic fn g where g = function (x) {3+.4*x-.60*(x*x)} Now, I want to maximize f given the constraints 1. g>0 and 2. 600
0
votes
1 answer

Struggling with my python program

So I'm writing this program for exercise in python : from math import sqrt Antwoord = 0 while Antwoord != "yes": print "In many cases of Maths there will be a quadratic equation" print "The question is how do you solve it? Through this…
0
votes
1 answer

quadratic programming with linear constraints(Matlab)

I need to minimize alpha in using quadprog in matlab 1/2*alpha.'*H*alpha+(-1.')*alpha subject to: y.'alpha=0 and 0<=alpha<=inf I have made the matrix H for a=1:8 for b=1:8 H(a,b)=y(a)*y(b)*dot((x(a)).',x(b)); end end but I am…
Morten
  • 3
  • 2
0
votes
1 answer

Find the min and max for quadratic equation

how to find the min and max for quadratic equation using c# ?? f(x,y) = x^2 + y^2 + 25 * (sin(x)^2 + sin(y)^2) ,where (x,y) from (-2Pi, 2Pi) ?? in the manual solving I got min is = 0 , max = 8Pi^2 = 78.957 . I tried to write the code based on liner…
0
votes
1 answer

R Linear model allow quadratic and first order but not higher

My current linear model is: fit<-lm(ES~Area+Anear+Dist+DistSC+Elevation) I have been asked to further this by: Fit a linear model for ES using the five explanatory variables and include up to quadratic terms and first order interactions (i.e.…
JRSR
  • 39
  • 1
  • 5
0
votes
2 answers

How to run a JS file and why mine isn't running

So i just started JS a while back, and im halfway through the course in Code academy. Sadly my exams came in between so i forgot a lot of what i learnt, so i decided to create a program, a very simple one to like refresh my memory. Now i googled how…
0
votes
2 answers

Error when linking function within a function

Please bear with me as this is probably a trivial question! I have no clue what I'm doing wrong. When trying to write a program to solve quadratic equations in a certain way I defined 3 functions: main, quad_roots and lin_root, where quad_roots…
SpiderCode
  • 10,062
  • 2
  • 22
  • 42
0
votes
2 answers

Is it possible to exclude hidden rows when searching for duplicates in Excel?

I am working on a procedure in Excel using VBA that highlights duplicate rows. The procedure evaluates the result of the worksheet function sumproduct to determine if the row has duplicates. The evaluated formula ends up looking like…
Kuyenda
  • 4,529
  • 11
  • 46
  • 64
0
votes
1 answer

Solve and find x for normally distributed functions

I'm trying to solve a equation and find the value for x from it. I'm using the following code: mu1 = 0 mu2 = 1 sigma1 = 0.5 sigma2 = 0.6 prior1 = 0.3 prior2 = 0.7 boundary = function(x) { return(( 1 / sqrt(2 * pi * sigma1)) * exp(-0.5 * ((x -…
Prav
  • 15
  • 1
  • 4