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
5 answers

Solving Quadratic Formula

I'm writing a program to solve quadratic equations using the quadratic formula but it only works when a = 1 but i want it to work when a is more than 1 Here is my code: import math def solve(a, b, c): x = ((-1)* b +…
Serial
  • 7,925
  • 13
  • 52
  • 71
0
votes
4 answers

Quadratic formula calculation in android?

Hello guys I m new to android and want to display the quadratic formula calculation here is the code i am doing in android there is no error showing in this code but still on the emulator its not displaying the result :-( public class MainActivity…
Zubair Ahmed
  • 2,857
  • 2
  • 27
  • 47
0
votes
5 answers

quadratic formula with scanner inputs

Okay so I am a complete Java noob, and I'm trying to create a program for class that runs a quadratic equation using scanner inputs. So far what I've got is this: import java.util.*; public class QuadraticFormulaSCN { public static void…
user2288274
  • 1
  • 1
  • 1
  • 1
0
votes
1 answer

Make error: install hqp (huge quadratic programming) on OS X

I am trying to install hqp on OS X, but seems the gcc compiler is quite different. When running make, I first come to an error like malloc.h not found, I wrap the #include header like: #if !defined(__APPLE__) #include #endif In this way,…
Yitong Zhou
  • 1,155
  • 4
  • 22
  • 42
0
votes
1 answer

programming a nonconvex optimization (quadratic maximization) semidefinite programming

just wonder if anyone could help me to solve a problem that goes like this: (with matlab and CVX) cvx_begin sdp variables x0 x1 x2 x3 y1 y2 y3 y4 y5 x0==1/sqrt(3) 1/3+x1^2+x2^2+x3^2+y1^2+y2^2+y3^2+y4^2+y5^2<=1 x1==-x3 y1==y5 y2==-y4…
0
votes
1 answer

PHP quadratic equation calculator strange output

Having written a quadratic equation calculator in PHP, I thought I would have most of my problems with the maths. Not so though, as I am getting very strange output. The program is supposed to $_GET the values of the x2, x, and other number from a…
imulsion
  • 8,820
  • 20
  • 54
  • 84
0
votes
0 answers

JS Quadratic Curve

So far I've been able to make a straight line graph sort of thing using circles and assigning to them a random x coordinate, and setting y equal to x. This worked. The trouble I'm having is with Math.pow() to do powers of x. It doesn't seem to be…
Maurice Tempelsman
  • 895
  • 2
  • 11
  • 13
0
votes
1 answer

Quadratic Formula Program Java?

Im writing a program, that takes the a, b, and c from an equation, and uses them to find x using the formula: http://www.purplemath.com/modules/quads/qform01.gif. The problem im getting, is that when I plugin the equation 1x^2 +3x +4 I get x =…
malymieczek
  • 33
  • 1
  • 7
0
votes
5 answers

Rounding errors in quadratic solver

I'm pretty new to python and am trying to write some code to solve a given quadratic function. I'm having some trouble with rounding errors in floats, I think because I am dividing two numbers that are very large with a very small difference. (Also…
user1934956
  • 1
  • 1
  • 1
0
votes
1 answer

What is the role of quadratic_error variable in Google's PageRank algorithm?

There's an implementation of Googles' PageRank on wikipedia: % Parameter M adjacency matrix where M_i,j represents the link from 'j' to 'i', such that for all 'j' sum(i, M_i,j) = 1 % Parameter d damping factor % Parameter v_quadratic_error quadratic…
Tool
  • 12,126
  • 15
  • 70
  • 120
0
votes
3 answers

What is an algorithm for solving quadratic with linear equation simultaneously?

Need an algorithm to solve equation like these: 8*p^2+8*q^2+8*p-16=0 p^2+q^2+12*p+20=0 If anyone can point me to the name of algorithm also it'll be enough. I could have followed any matrix related algorithm but the quadratic inside these linear…
user1693086
0
votes
2 answers

Attempting to program quadratic formula?

I am new to Java - one of my first projects is to build a calculator. Attempted to program a quadratic equation; and although I got no errors, I got the wrong answer. void quadratic() { if((b*b-4*a*c) < 0){ System.out.println("The…
Fraser Price
  • 899
  • 6
  • 15
  • 36
0
votes
2 answers

quadratic equation

Question: I have a program that solves a quadratic equation. The program gives real solutions only. How do I perform the quality testing of the program? Do you need to ask me for some extra input parameters?
0
votes
3 answers

In a curve, how do I calculate the Y position of a point for a given X?

I'm creating an interface control in an iPhone app where views are positioned in an arc, corresponding to the X touch position. I need to write a function that, given an X value, returns the Y value that corresponds to the red line on the graph…
user2393462435
  • 2,652
  • 5
  • 37
  • 45
-1
votes
1 answer

Pre Requisite for bootcamp, Quardratic Equation, I am stuck

Just going to link the question; I have no other info to go off of; and I am very confused, Would love a solution; but also if you could explain the how and why, that would be extremely helpful TYIA PROBLEM FROM TEST