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

Quadratic Equation Visual Basic 2010+

I have to write a program which calculate quadratic equation and find its roots. The roots must be displayed via MsgBox-es, and the variables A, B and C must be entered via InputBox-es. For now I have written this, but it somehow doesn't work and I…
-1
votes
3 answers

Void function (c++)

I want to create a program that solve quadratic equation (Ax²+Bx+C=0) using 2 void functions: one to insert the values of A,B,C, and the second for solving the equation. This is what I did: #include #include using namespace…
saad riadi
  • 15
  • 2
-1
votes
1 answer

Pulling all numbers from a quadratic equation using RE

I have the below quadratic equation from which i'm looking to pull the constants into a tuple to find the factors. 3*(x**2)+5*x+6 - (I also don't want to pull the power 2). I tried the below expressions. Most of them seem to be returning…
Jayaram
  • 6,276
  • 12
  • 42
  • 78
-1
votes
1 answer

Plotting a quadratic equation in Delphi/Lazarus

I am trying to animate an object's position using a quadratic equation to get a Rapid-Start-Slow-Stop kind of movement. This is already available in Delphi XE6 but I am using Delphi XE2 and Lazarus and I have created my own animation handling system…
xaid
  • 740
  • 6
  • 18
-1
votes
1 answer

I am new to those stuff i have to do a quadratic equation for school

I have to make a quadratic equation in Microsoft Visual Studio. #include #include #include int main() { float a, b, c, D, x1, x2; printf("Type in a :\n"); scanf_s("%d", &a); if (a == 0) { …
-1
votes
1 answer

Quadratic Formula in Java for Android, can't spot my mistake

I'm currently making an app for finding the roots of polynomials for android. At the moment I'm just dealing with quadratics however I can't spot my error. Whatever I've done it means my value for the root (only doing the first root right now), is…
Ryan Firth
  • 15
  • 2
-1
votes
1 answer

c++ quadratic equation. wrong results

I wrote this code to find the roots of quadratic equations. The code is this: #include #include using namespace std; int main() { double a,b,c; double x,x2; cout<<"Give a: "; cin>>a; cout<<"Give b: "; …
user1584421
  • 3,499
  • 11
  • 46
  • 86
-1
votes
1 answer

Identifying errors in quadratic equations

Suppose you write a Python program to calculate the real roots of ax2 + bx + c = 0, where the coefficients a, b and c are given, real numbers. The traditional formulas for the two solutions are x1 = (-b - sqrt(b*b-4*a*c)) / 2a, x2 = (-b +…
orange127
  • 1
  • 2
-1
votes
1 answer

Android Quadratic Equation, change double value from Edit text

can someone please help me, I am trying to do a simple quadratic equation app, and I can't figure out how to make the double variables get the value from the text inputed in the Edit text field
Sartheris Stormhammer
  • 2,534
  • 8
  • 37
  • 81
-1
votes
2 answers

quad.rb:8: syntax error, unexpected tIDENTIFIER, expecting ')'

When trying to write a code for a quadratic equation to figure out the x's, I get an error saying there is a problem with the parenthesis Here's the code i have entered for this calculator puts "A" a = gets.to_f puts "B" b = gets.to_f puts "C" c =…
-2
votes
1 answer

How do I ask the user if they want to solve the equation again with a yes or no answer in Python?

Here's my code. import math print('I will solve the equation ax^2=bx=c=0') a = int(input('a= ')) b = int(input('b= ')) c = int(input('c= ')) d=b**2-4*a*c if d < 0: print('The equation has no solution') elif d == 0: x=(-b)/(2*a) …
tvrynx
  • 1
  • 1
-2
votes
1 answer

How to plot a graph (e.g. u-shape) to show the non-linear relationship in panel data gression?

I am a freshman in doing regerssion and also in using python / r I am now studying the non-linear relationship between ESG performance and Financial Performance of companies, with a set of panel data and the following equation: ROA = C(1) + C(2)*ENV…
-2
votes
2 answers

How do I find the value of a quadratic equation? For instance the value of (-12+√(b^2-4ac))/2a

(-12+√(b^2-4ac))/2a (where a = 1, b = 5, c = 3) How do I write a code for a quadratic equation?
-2
votes
1 answer

Is there a code/function that solves an equation for either X or Y?

I have a simple quadratic equation, but I need to find a way for R to solve for X or Y depending on the value I input for either. For example, my equation is y = 232352x^2+2468776x+381622 I need to find a code that solves for y when x = 8000 and…
Amsi
  • 11
  • 2
-2
votes
1 answer

how is the quadratic formula used in game coding?

hello guys i am game programmer from korea. and just today i found a some code that use the QUADRATIC formula for calculating something. here is code hduVector3Dd p = startPoint; hduVector3Dd v = endPoint - startPoint; // Solve the intersection…
KIM CHANGJUN
  • 99
  • 11