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
1
vote
1 answer

Best fit quadratic regression

I'm running into an odd problem; get my dataset here:dataset All I need is a simple graph showing the best-fit regression (quadratic regression) between rao and obs_richness; but instead I am getting very different polynomial models. Any suggestions…
I Del Toro
  • 913
  • 4
  • 15
  • 36
1
vote
0 answers

Polynomial fit with minima/maxima constraint

I have noisy data that should fit a quadratic function. Specifically: The data should fit a portion of a parabola The parabola may open either up or down The peak is guaranteed to not be within the dataset The peak is guaranteed to be in a known…
Chris Arguin
  • 11,850
  • 4
  • 34
  • 50
1
vote
3 answers

Types In C Displaying Imaginary Numbers

I have a question about types in C and I think it has to do with "real's"... This program is a quadratic equation solver and the user inputs a, b, and c in terms of ax^2 + bx + c = 0. My program works and I am sorry for lake of comments in the code…
T.Malo
  • 512
  • 1
  • 7
  • 24
1
vote
2 answers

Scheme quadratic function/square root check

Im want to make a function where rootcheck has a list L as input, L always is 3 atoms (a b c) where a is coefficient of x^2, b coef of x and c is the constant. it checks if the equation is quadratic, using discriminant (b^2 - 4ac) and should…
user3241846
  • 643
  • 3
  • 9
  • 26
1
vote
0 answers

Draw approximate curve using quadratic equation

I have a graph that generates 4 curves and I need to draw an approximate graph using ax2+bx+c for a particular area. So I have. Collection of data points (x,y).... up to ....1000 My question: 1. is there any algo for selecting appropiate three point…
user765443
  • 1,856
  • 7
  • 31
  • 56
1
vote
4 answers

Time - Gravity Fall program

I am trying to create a program that will work out how long it will take for something to hit the ground when dropped from a particular height and it uses the known quadratic formula. The program appears to be doing what I want of it until it…
user2633836
  • 131
  • 3
  • 5
  • 13
1
vote
2 answers

Quadratic Program Java returning wrong results

So I had to make a program in Java to solve for the values of "x" using the quadratic formula, and this includes imaginary and real numbers. The problem is that my code doesn't seem to give correct results for the following 3…
Mo2
  • 1,090
  • 4
  • 13
  • 26
1
vote
1 answer

Quadratic functions in c

I have almost everything working except for solving for X in line 25 i keep getting an error saying " term does not evaluate to a function taking 1787 arguments" i had it giving me a 1 or a 0 but as i kept messing with it i lost where i was at and…
Pwoods
  • 105
  • 2
  • 4
  • 15
1
vote
1 answer

Draw Quadratic Curve

How can I draw Quadratic Curve through 3 points by using C# System.Drawing namespace?
Pavel Podlipensky
  • 8,201
  • 5
  • 42
  • 53
1
vote
4 answers

Objective C - Quadratic equation solver

So, im making an app that solves quadratic equations. The main interface simply asks the user to input the values of A, B, and C. The problem is, I'm not getting the right answer. Here's the code: NSString *intStringa = [NSString…
Daniel Ruhman
  • 123
  • 2
  • 13
1
vote
1 answer

Solving an implicit quadratic system of 3 variables

I am trying to solve a system of equations that has 3 variables and a variable number of equations. Basically, the system is between 5 and 12 equations long, and regardless of how many equations there are, I am trying to solve for 3 variables. It…
KevinShaffer
  • 760
  • 5
  • 14
  • 26
1
vote
1 answer

solve.QP cannot maximize a positive definite quadratic function

I have an extremely simple quadratic problem that should in principle be solvable by solve.QP (quadprog): max x^2+3*y^2 subject to x>=0, y>=0, x+y <=1 The problem is that turning the maximization into the required minimization, the matrix…
user1783444
  • 121
  • 3
1
vote
4 answers

Can someone please look over my code for the quadratic equation (in java)?

Could someone please look over my code for the quadratic equation? I always get an error with root2 ("The primitive type double of root1 does not have a field root2). I just need to print out the two roots. Thank you. public class QuadraticEqn…
user1755022
  • 77
  • 3
  • 8
1
vote
2 answers

Compute real roots of a quadratic equation in Pascal

I am trying to solve this problem : (Write a program to compute the real roots of a quadratic equation (ax2 + bx + c = 0). The roots can be calculated using the following formulae: x1 = (-b + sqrt(b2 - 4ac))/2a and x2 = (-b - sqrt(b2 - 4ac))/2a I…
Waleed
  • 31
  • 1
  • 1
  • 4
0
votes
2 answers

How do I use letter as a variable/placeholder in a math equation?

Sorry if that title confused you its kinda hard for me to ask this without explaining it. I am writing a (fairly) simple program to find the roots of a quartic (biquadratic) function. My main question (I should know this >.>) is how do i get x in…
Ryan - Llaver
  • 528
  • 4
  • 19