Questions tagged [cubic]

Pertaining to cubing, or being of the third power. In mathematics, it is notated as a superscript three (x³). Use this tag for programming-relevant questions that involves cubic equations and similar concepts, which have applications such as computational complexity, and cubic spline interpolation. This tag is not to be confused with the "cube" tag, which refers to the *OLAP cube*.

Cubic means of degree three. Variables raised to the third variable are called cubes in algebra, and a cubic polynomial is a third-degree polynomial.

Cubic polynomials are polynomials whose highest degree is three. All cubic polynomials of one variable are of the form A*x^3 + B*x^2 + C*x + D where leading coefficient A is nonzero. The graph of a cubic function rises for positive A, and falls for negative A, but it is described as "bendy" and that it has an inflection point.

All cubic polynomials have three complex roots, where one to three of the roots are real. Therefore, all cubic polynomials may be factored as (x-p)*(x-q)*(x-r) where p, q, r are complex and potentially real roots. All three complex roots of every cubic polynomial can be solved in terms of radicals, this is known as the Cardano formula.

The first derivative of a cubic polynomial is a quadratic polynomial, which is 3*A*x^2 + 2*B*x + C

Here are the graphs of five cubic polynomials.

enter image description here

Cubic Spline Interpolation is a process where a shape or curve is approximated or interpolated by piecewise cubic functions. This is useful for extrapolating sets of points or data with a smooth curve, as well as approximating shapes and fonts.

Here is an example of a cubic spline interpolating a series of five points.

Source: http://mathworld.wolfram.com/CubicSpline.html

Cubic Complexity means having an asymptotic complexity of O(x^3). That means, it grows similar to a positive cubic function A*x^3 + B*x^2 + C*x + D as x grows, or in calculus terms, f(x) == O(x^3) if the limit as x grows to positive infinity, f(x)/x^3 is a constant.

There are two forms of cubic complexity: cubic space and cubic time, indicating that this program or algorithm asymptotically requires extra memory space or took time equal or less than the cube of the size of the input n respectively. It is worse than quadratic complexity, but it is still considered efficient as it is in polynomial complexity. Matrix multiplication between m×k and k×n matrices is a cubic-time algorithm of time O(m*k*n), whereas the best square matrix multiplication can be done faster than cubic time but still slower than quadratic time; matrix multiplication is therefore a cubic time algorithm.

Related tags

  • : Generalization of 'cubic' and 'quadratic' by having any (constant) degree.

  • , : Tags referring to lower polynomial times

  • , , : Tags relating to complexity, including the famous polynomial time such as linear time, quadratic time, and cubic time.

  • : Applications of cubic polynomials where a curve or point set is approximated by piecewise cubic polynomials.

  • : Do not confuse between "cubic" and "cube" tags. Here, the "cube" tag refers to the OLAP cube datastructure.

Read More:

103 questions
0
votes
0 answers

How to plot a restricted cubic spline with A on the x-axis and the hazard of death on the y-axis?

I want to depict Restricted cubic spline models to show the association of A with all- cause mortality. I have used the following function. How can I change the y-axis to "hazard ratio of death" ? enter image description here Please let me know what…
0
votes
1 answer

Creating a function given a set of data points

I am working on a function in C programming and would like to create a function based off of the given data points but I cannot seem to get something that fits this curve. See graph here: My program will primarily use this function in the 0-500°F…
Accentrix
  • 23
  • 6
0
votes
0 answers

Gudhi: The kernel appears to have died. It will restart automatically

import gudhi as gd f= 'E:/PHD/persistance/image.txt' # compute PH md_cubical_complex = gd.CubicalComplex(perseus_file=f) # result md_cc_diag=md_cubical_complex.persistence() pd_array=pdarray(md_cc_diag) …
0
votes
0 answers

Quintic model from a linear regression

I am attempting to fit a linear regression model of degree 5 ( with 4 columns of degree 2,3,4,5: x2,x3,x4,x5,) and use them with x as predictors of y of the linear model below. lm.out= lm(y~x) coef(lm.out) ypred= predict(lm.out) resids=…
Charlie
  • 11
  • 2
0
votes
1 answer

How to solve a cubic function without knowing the coefficients a b and c?

Apology for this silly question. In the cubie function below (as from a school project), I am given the value for x and f(x) while coefficients a, b ,c and constant of d are unknown. f(x)=ax^3+bx^2+cx+d In such case, is there a way to find out a,…
user032020
  • 406
  • 2
  • 13
0
votes
1 answer

How to solve the "R2 invalid mem access 'inv'" error when i try to loading the ebpf file named bpf_cubic.c

The linux kernel source code version is 5.11.0 I tried to load the congestion control algorithm which is implemented by eBPF. The file is linux-source-5.11.0\tools\testing\selftests\bpf\progs\bpf_cubic.c. I used the libbpf-bootstrap so I made some…
earle
  • 7
  • 2
0
votes
1 answer

Cublic Spline Interpolation of Phase Space Plot

I am creating a phase-space plot of first derivative of voltage against voltage: I want to interpolate the plot so so it is smooth. So far, I have approached this by interpolating the voltage and first derivative of the voltage separately with…
Joseph
  • 578
  • 3
  • 15
0
votes
1 answer

When an input number is given as input. The input digit should be read and nearest cubic root value will be displayed as output

For example: Input = 21 Nearest cubic root values for above digit are: 2 and 3 8 = 2*2*2 27 = 3*3*3 Among those values, 27 is nearer to 3, so it should be displayed as output.
Rocher
  • 1
  • 1
0
votes
2 answers

Cardano's Formula in Python

I need someone to check my attempt in using Cardano's Formula in Python. I'm trying to solve for the roots of a cubic equation, and I'm wondering if what I'm doing is correct (or wrong) so far. TYIA def solve(a,b,c,d): Q = (3*a*c - (b**2)) /…
Kiel
  • 9
  • 3
0
votes
1 answer

Unable find real root for Cubic Equation in C++

I am writing a C++ program for finding the real root, x for a cubic equation 〖ax〗^3+〖bx〗^2+ cx+d=0 where a≠0 and b=0. Unfortunately, I could not output the "test case 1 & 4" (ps. sample output provided below link). Perhaps any logic syntax in my…
0
votes
1 answer

Cubic Equation solver in a loop: Python

I'm working on a van der waals equation of state calculator that that imports critical properties data from a spreadsheet, and uses those properties to calculate the volume and compressibility factor of a substance specified by the user. So far the…
0
votes
0 answers

How to get the qubic root from very large number with python

I need a function, that counts qubic sqrt from numbers like…
Goldus
  • 109
  • 2
  • 6
0
votes
1 answer

Cubic spline interpolation factors required to pass through original datapoints (scipy, python)

I am using scipy.interpolate.interp1d for cubic spline interpolation of a signal. While I believe interpolated signal should pass through all original data points, this is not the case when interpolating with certain factors. e.g. if there are N…
Joseph
  • 578
  • 3
  • 15
0
votes
0 answers

Natural cubic spline function in MATLAB

I am trying to write a MATLAB function which interpolates data points in X to create a natural cubic spline, similar to interp1 but without using interp1. The function takes inputs vector x and c (from the system Ac=Y) and vector X of data points…
MatMac
  • 1
0
votes
0 answers

How to implement cubic spline interpolation in 3 dimensions?

I am trying to implement cubic spline interpolation in 3 dimensions, however I am unsure how to modify the code I have currently written to implement the z-axis. The purpose of this code will be to calculate a trajectory between a starting point and…
csStudent2102
  • 75
  • 1
  • 7