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 do I make the parabola calculated from given points change as the points are moved?

I'm trying to get students to be able to drag the three points around to show the three intercepts of a quadratic (with real roots) then have jsxgraph draw the parabola that matches those three points. I've got the maths working no dramas but I…
0
votes
1 answer

I made a calculator for finding the standard form of a vertex form quadratic. Weird issues after making it to receive user input

First, I use this as the base for the calculator. let h = -2 let a = 3 let k = 10 let step1 = h * h let step2 = h + h let step3 = a * step2 let step4 = a * step1 let step5 = step4 + k console.log(a + "x² + " + step3 + "x + " + step5) It works,…
david
  • 1
0
votes
1 answer

Quadratic equation: TypeError: bad operand type for unary -: 'str'

I´m new to Python and have been trying to code the quadratic equation, but i keep running into this error: TypeError: bad operand type for unary -: 'str' def quad_gleichung(): a = input('a:') b = input('b:') c = input('c:') x1 = int(-b + (b**2 -…
Marina
  • 17
  • 3
0
votes
1 answer

I need to solve a quadratic

Write a function solve_quadratic, that returns both solutions of a generic quadratic as a pair (2-tuple) when the coefficients are given as parameters. It is throwing back decimals and showing an error? import math def solve_quadratic(a, b, c): …
DeDe
  • 1
  • 1
0
votes
0 answers

Quadratic function implementation error in R's nlme

I'm trying to fit a quadratic function to an HLM model using R's nlme. My data looks like this: Data <- structure(list(X = c(2L, 3L, 4L, 5L, 22L, 23L), userId = c("0014","0014", "0014", "0014", "0059", "0059"), who_score = c(24L, 60L, 40L,…
Navot Naor
  • 59
  • 5
0
votes
1 answer

How to extend the curve created using quadratic interpolation in C# & Unity?

I am attempting to use quadratic interpolation in order to throw a rock at the player's position. The rock simply follows the curve. However, if the player moves, the rock begins to loop and starts back at its original position. I have stopped the…
0
votes
1 answer

What is the meaning of mod in quadray of Pari software

I need a polynomial that defines the narrow Hilbert class field of the real quadratic field x^2-505. How quadray could do this? quadray(x^2-505,-1)? What is the meaning of Mod in output? x^4 + Mod(-19*y - 207, y^2 - y - 126)*x^3 + Mod(305*y + 3277,…
0
votes
1 answer

How do I find out roots of quadratic equation in C?

I'm pretty new to C and I'm just starting out with some beginner questions. I code I wrote below seems correct however the answer is incorrect. Can any help me figure? #include #include int main() { system("cls"); int a,…
0
votes
0 answers

Usage and determination of the arguments of quadprog::solve.QP

The function of quadprog looks like that: solve.QP(Dmat, dvec, Amat, bvec, meq=0, factorized=FALSE) My objective function is: And my two constraints are: Now my aim is to determine the single arguments. 1) First argument Dmat: In the generel…
0
votes
1 answer

Quadratic/parabolic interpolation

I have this curve (COVID-19 cases per 100,000 inhabitants in California between 2020-09-01 and 2021-03-01): It's clear that the dip at the end of December 2020 is an artifact of testing's having gone down during the winter holidays (the nadir…
dbcrow
  • 45
  • 1
  • 5
0
votes
0 answers

How do I add a quadratic constraint using an expression defined through variables of a model that I copied in gurobi?

I am trying to do the following in gurobipy: create a model add variables define a quadratic expression containing those variables creating a new model that is a copy of the first one defining a constraint for the new model using the quadratic…
Ronin
  • 27
  • 4
0
votes
2 answers

Where am I going wrong in this MIPS code?

So, i am new to MIPS and was writing a code for quadratic formula... I think i did everything right, but my program always give wrong answers and sometimes it aborts with Exception at PC 0x004000f8 please if anyone can tell me where I am going wrong…
Shaheer
  • 50
  • 6
0
votes
1 answer

Iterating using a quadratic sequence in Javascript

I have a quadratic sequence in which I need to use to loop over, however, I am not sure how to execute this kind of logic... I want to use the quadratic sequence to count up to a given number <= n. The problem is that I have to give my quadratic…
King Muze
  • 75
  • 7
0
votes
0 answers

Add quadratic line in R plot

I drew phillips curve for 2007-2020 and I want to add quadratic trend. My phillips curve form is as follows: plot(u, p, xlab="u", ylab="p")
0
votes
2 answers

When should you start treating a quadratic as a linear in numerical root-finding?

I have a set of quadratic coefficients a, b, and c the need to be solved in order to determine the intersection between two graphs on a plane (lets say, a parabola and a line). My problem, however, is that when my parabola is so "stretched out" that…
Gary Allen
  • 1,218
  • 1
  • 13
  • 28