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
-3
votes
2 answers

Big O time efficiency for a quadratic function in JavaScript

I am trying to increase the efficiency of a function. It is currently quadratic and I would like to make it logarithmic. The third to last line of the current function is confusing me somewhat as well and I would like some clarification. function…
aluko17
  • 21
  • 3
-3
votes
2 answers

Java program to find integer root of a quadratic equation

So, here is my requirement. If a quadratic equation has two roots(an int & a float), I want to take only integer value for further manipulation. I can't figure it out how it's made. Can anyone tell me please. (Java would be better).
-3
votes
2 answers

Quadratic equation program is not giving values

Could you tell me what's wrong with my code for solving a quadratic equation? Don't be cringed out by my work, because I'm still very new to the program. class Program { static void Main(string[] args) { double a, b, c, x1, x2, x,…
-3
votes
1 answer

Using python in math

Ok so i want to solve this equation through python but cant figure out what to do! I tried using for loops but that didn't work so well Im new to python so can anyone suggest what I should do RWBG-(WBR^2)-WBR-(BR^3)-(3BR^2)+2BR-(R^3)-(6R^2)+11R-6 =…
-3
votes
2 answers

pq method math to the function of a*x*x+b*x+c=0

Question : I thought the source code is right and it worked well a lot of times for example at functions like : x^2 + 4x +4 or 3x^2 +5x+1 but in some functions the output is NaN and i don't understand why (function that outputs NaN : 4x^2 - 2x +8…
burakburi
  • 23
  • 1
  • 7
-3
votes
3 answers

Why does it show Nan when i run this?

This code is to solve a quadric equation in Java. It output puts Nan. What is the wrong and how can I resolve this? I tried a=1, b=2, c=10. import java.util.*; class equation { public static void main(String args[]) { int a, b, c; String…
Nimantha
  • 147
  • 4
-3
votes
1 answer

How can I change this if-statement to switch?

//is the following code about quadratic formulas convertible to switch method? Public class blah blah Public static void main(String[] args) { System.out.println("enter letter a"); New Scanner= System.in Int a = input.nextint() //same…
user5573493
-3
votes
2 answers

Quadratic equation with complex roots

I am just learning visual basic and have been trying to write a code to solve quadratic equations with complex number as roots. Any pointer in the right direction would be appreciated. Public Class Form1 Dim a, b, c As Integer Dim x1, x2 As…
High Zedd
  • 53
  • 10
-3
votes
1 answer

c++ quadratic equation code output error

Ok, so i am creating a quadratic equation solver in c++ and cant seem to get the right output on imaginary numbers. the real number roots come out fine (e.g. x= 2 and x = 5) but when the imaginary numbers come out, something weird happens where it…
-3
votes
3 answers

using math class in java

I'm trying to calculate the power of a double to calculate the Quadratic Formula Here is the code: private Scanner sc; double a, b, c; // Input Coefficients public void InputCoeff() { sc = new Scanner(System.in); System.out.println("Please…
-4
votes
2 answers

Using Python for basic Quadratic Inequalities

I'm struggling to figure out how to properly use Python to solve a quadratic inequality. I'm trying to learn Python a bit and I'm trying to work through a quadratic inequality. I have a range of numbers for x from -5 to 5 and I want to use the…
ked123
  • 19
  • 6
-5
votes
1 answer

Which equation represents quadratic time

I believe it is 3n+5n^2+1 but I am not 100 percent sure. If I am wrong can someone explain to me why?
hotrod28
  • 45
  • 8
-5
votes
2 answers

How to write a java program using methods to calculate value of equation?

I need help writing this in elipse... Write a java program using methods to calculate value of the below equation x2+2x+6 Details: 1. create a method called equation(int x), with one argument. 2. we need to pass an integer as an argument to…
Rose
  • 1
  • 1
  • 1
  • 1
-7
votes
1 answer

How to solve this equation

N = 1298 + 74.86*C + 1.283*C^2 − .0078*C^3 − .0006*C^4 I'm using this equation in my project, which has to be solved for to find C. I'm using this formula in python, this equation can be easily calculated in scientific calculator but i want it to do…
7vik ja9
  • 61
  • 1
  • 5
-8
votes
4 answers

Simple Java Code

"3. Write a method which takes in three real numbers a, b and c representing the coefficients of a quadratic equation ax2 + bx + c and uses the quadratic formula to determine one solution of the equation ax2 + bx + c = 0. Use an if statement to…
user2705929
  • 9
  • 1
  • 1
1 2 3
27
28