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

What's wrong with this function to solve cubic equations?

I am using Python 2 and the fairly simple method given in Wikipedia's article "Cubic function". This could also be a problem with the cube root function I have to define in order to create the function mentioned in the title. # Cube root and cubic…
user2330618
3
votes
4 answers

CUDA: 1-dimensional cubic spline interpolation in CUDA

I'm making a medical imaging equipment. I want to use CUDA for making faster equipment I receive 1024 size 1d data from CCD 512 times. before I perform IFFT I have to apply high performance interpolation algorithm (like cubic spline…
user1431861
  • 31
  • 1
  • 2
3
votes
2 answers

How to calculate non-zero dx/dt and dy/dt at t = 0 when P0 == P1 on a cubic Bezier curve?

Before I begin the problem, I use P0, P1, P2, and P3 for the four cubic Bezier points, and 't' since it's parametric. Also, I have searched for a similar problem in this site, as well as Google, and couldn't find one. I apologize if this is a…
Ootawata
  • 63
  • 1
  • 7
2
votes
2 answers

Cubic Spline Python code producing linear splines

edit: I'm not looking for you to debug this code. If you are familiar with this well-known algorithm, then you may be able to help. Please note that the algorithm produces the coefficients correctly. This code for cubic spline interpolation is…
daniel
  • 79
  • 1
  • 1
  • 8
2
votes
1 answer

Why does scipy.griddata return nans with 'cubic' interpolation if input 'values' contains nan?

I want to perform cubic interpolation of an array that contains some nan values using scipy.griddata. However, as soon as a single nan is present in the values parameter, the returned interpolation is filled with only nan. This is not the case when…
Jann
  • 635
  • 1
  • 6
  • 17
2
votes
0 answers

How to draw Cubic bezier curve in react application using d3.js

I am trying to draw a cubic bezier curve in my React application which can be dragged up and down from a control point which is near the apex of the curve and from the end point of the curve. I have drawn the svg curve but unable to manipulate it’s…
2
votes
0 answers

Weird Problem in Calculating Cubic Root in R

If I set x=0, and then calculate: ((x+1)/(x-1))^(1/3); I get NaN But I don't get a problem if I do: -1^(1/3) The following two ways also cause errors: ((0+1)/(0-1))^(1/3) ((1)/(-1))^(1/3) And, of course, the output of ((x+1)/(x-1)) is -1 Anyone…
Jorge Lopez
  • 467
  • 4
  • 10
2
votes
1 answer

Find a real number in a set of complex numbers

I am looking for a way to find a real number in a set of complex numbers in excel-vba. More specifically I have a set of three results out of which one is known to be real and two are known to be complex, however, I don't know which of the results…
2
votes
0 answers

Example of three.js KeyframeTrack with smoothing (cubic interpolation)

I looking for some clarity on how to implement smoothing (a.k.a. cubic interpolation) on a three.js animation KeyframeTrack. From my testing, parsing the interpolation method in the KeyframeTrack constructor is insufficient. var position = new…
Richie
  • 19
  • 5
2
votes
1 answer

How can I plot the derived function of cubic spline interpolation?

I want to ask how I can plot the derived function of cubic spline interpolation? I show how I did it in my code. The error was: Error using plot Invalid second data argument Error in function_MTU4000_Real (line…
Ozan
  • 27
  • 5
2
votes
3 answers

Cubic Spline class for Obj C or C?

I need to use natural cubic spline interpolation in an iPhone app. Does anyone know of a class for Obj C or C that resembles this: http://www.ee.ucl.ac.uk/~mflanaga/java/CubicSpline.html "performing an interpolation within a one dimensional array…
ransomweaver
  • 472
  • 6
  • 19
2
votes
1 answer

How to get points of a Curve (Shape)

I have a CubicCurve in Java which is defined by 4 control points. I can draw the resulting shape, but how can I receive efficient every point in a given resolution of this shape? By the way PathIterator "only" returns the control points but not the…
Thomas
  • 1,622
  • 17
  • 24
2
votes
2 answers

Java 2D Array Bicubic Interpolation

I have recently been playing around with Bicubic Interpolation, as I am wanting to generate the earth, based on real heightmaps inside Minecraft. The reason I am using the interpolation, is because I would like to make the world have more detail.…
user3853021
2
votes
1 answer

How to implement a piecewise function and then plot it on certain intervals in MATLAB

I am actually attempting to write code for the cubic spline interpolation. Cubic spline boils down to a series of n-1 segments where n is the number of original coordinates given initially and the segments are each represented by some cubic…
mtprogrammer
  • 97
  • 1
  • 2
  • 8
2
votes
1 answer

how to create bezier curve in JavaScript?

I am trying to create a bezier curve using JavaScript on a HTML5 canvas. Below is the code that I have written us in the drawbeziercurve function. The result is that, I only get the four points, but cant get the bezier curve to appear. Any help…
user4198067