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

CPLEX quadratic simplex?

Does anybody know which simplex-like algorithm CPLEX uses to solve quadratic programs. what is the so called Quadratic Simplex it is using? Thank you in advance, Mehdi
Mehdi
  • 1
  • 1
0
votes
1 answer

Basic javascript solving quadratic equations

Very new programmer, trying to make a quadratic equation solver in javascript. //QuadSolver, a b c as in classic ax^2 + bx + c format function quadsolve(x, a, b, c) { var sol = ( ((a * (x * x)) + (b * x)) + c …
0
votes
0 answers

Quadratic Programming Solver Function in R

I'm looking for a quadratic programming solver function to use in R. My matrix is symmetric positive semi-definite. My constraints are of the form Ax>=b and x>=0. I am working in RStudio version 3.3.1. I'm new to solving quadratic programming…
0
votes
1 answer

[Nonsense question stemming from a simple typo]

My confusion was just based on a typo in my code - nothing interesting to learn here! I simply plotted the wrong function, see my comment to the accepted answer. Here are some seemingly harmless Python code import matplotlib.pyplot as plt import…
Peter Arndt
  • 115
  • 4
0
votes
1 answer

How do I write a code in C++ for fitting a quadratic polynomial to a dataset?

I'm not brilliant at coding, I'm just starting off and the code I created runs with that many errors I feel like I should just start again, but I have no clue what to do differently. Below is the code I'm running that's coming back with all the…
0
votes
2 answers

Quadratic Expression. Bugs

I am a beginner in JavaScript programming and this is my first project. I am trying to find the factors of a quadratic expression using the standard factorization method. I have explained the logic I used in the code as a comment at the beginning of…
Edewor
  • 11
  • 2
0
votes
2 answers

Quadratic formula: python treating floats as strings

I am making a program that asks the user to input values for a, b and c which are then used to compute the roots using the quadratic formula. The only problem I have is that python treats a and the square root term as two strings and they are not…
lain
  • 5
  • 1
0
votes
1 answer

What's the problem with this code for a resolvent calculator?

This code is for a resolvent calculator (the variables are in Spanish, but I think you will have no problem reading it). I don't know why this code doesn't work. #include #include #include using namespace std; int…
0
votes
2 answers

C++ passing function's result to another function

I've tried to check resources online but don't seem to quite manage to pass the result from a function into a 2nd one. I coded a program to solve the quadratic formula and need to use the discriminant (returned in the first function…
user14289562
0
votes
0 answers

Trying to put the code I made that solves Quadratic and Linear equations into a GUI using tkinter. How can I do this?

This is the code I have written. I have attempted to get a GUI that just places the Quadratic and Linear equation into the GUI so it can be solved in a visual way by the user from tkinter import * master = Tk() var1 = IntVar() Checkbutton(master,…
0
votes
2 answers

How can I print the solutions as a fraction, not like that?

**I am trying to make a function return the results of a Quadratic equation, But I can't figure out how to print the solutions as fraction. Please help me! ** def cube_root(x): return x**(1/3) def Quadratic(a, b, c): delta = (b**2)-4*a*c if…
0
votes
2 answers

Coding on the TI-84 calculator

ti 84 plus ce command line copy/paste and/or store a line for later use. I'm attempting to create a Program for a Quadratic equation and asking if there is a quicker way to copy a line and paste it under in the next line on the command line. (See…
0
votes
1 answer

I can't figure out how to find the two imaginary numbers

So, I wrote a Java program that finds the solutions to a quadratic equation and my problem is I can't seem to write the right code to find the "imaginary numbers" when it prints out I just get "NaN". Any solutions? import java.util.Scanner; class…
thomas
  • 19
  • 1
0
votes
0 answers

how to solve non-linear simultanoues quadratic equation in R

I am looking for solution of the following stype of non linear simultaneous equations: [latex] $$ p[\frac{x}{(y+x)^2} +(1-p).\frac{z}{(y+z)^2}] = \frac{1}{l} $$ [/latex] [latex] $$ \frac{y}{(y+z)^2}= \frac{1}{h} $$ [/latex] [latex] $$…
rajib
  • 1
  • 1
0
votes
0 answers

Quadratic equation returns 0 in some cases

for example when i say x:9 p:3 q:2 it returns x1:(-0-0j) x2:-0-0j. thanks for the help in advanced! import math, cmath from math import * from cmath import * x = input("input x value:") pA = input("input p value:") qA = input("input q value:") p =…
Lukas Schulte
  • 15
  • 1
  • 5