Equation Solving

CubicFormula
CubicFormula (p)

Compute roots of a cubic (degree 3) polynomial using the cubic formula. The polynomial should be given as a vector of coefficients. That is 4*x^3 + 2*x + 1 corresponds to the vector [1,2,0,4]. Returns a column vector of the three solutions. The first solution is always the real one as a cubic always has one real solution.

See Planetmath, Mathworld, or Wikipedia for more information.

EulersMethod
EulersMethod (f,x0,y0,x1,n)

Use classical Euler's method to numerically solve y'=f(x,y) for initial x0, y0 going to x1 with n increments, returns y at x1.

Systems can be solved by just having y be a (column) vector everywhere. That is, y0 can be a vector in which case f should take a number x and a vector of the same size for the second argument and should return a vector of the same size.

See Mathworld, or Wikipedia for more information.

EulersMethodFull
EulersMethodFull (f,x0,y0,x1,n)

Use classical Euler's method to numerically solve y'=f(x,y) for initial x0, y0 going to x1 with n increments, returns a 2 by n+1 matrix with the x and y values. Suitable for plugging into LinePlotDrawLine.

Systems can be solved by just having y be a (column) vector everywhere. That is, y0 can be a vector in which case f should take a number x and a vector of the same size for the second argument and should return a vector of the same size.

See Mathworld, or Wikipedia for more information.

FindRootBisection
FindRootBisection (f,a,b,TOL,N)

Find root of a function using the bisection method. TOL is the desired tolerance and N is the limit on the number of iterations to run, 0 means no limit. The function returns a vector [success,value,iteration], where success is a boolean indicating success, value is the last value computed, and iteration is the number of iterations done.

FindRootFalsePosition
FindRootFalsePosition (f,a,b,TOL,N)

Find root of a function using the method of false position. TOL is the desired tolerance and N is the limit on the number of iterations to run, 0 means no limit. The function returns a vector [success,value,iteration], where success is a boolean indicating success, value is the last value computed, and iteration is the number of iterations done.

FindRootMullersMethod
FindRootMullersMethod (f,x1,x2,x3,TOL,N)

Find root of a function using the Muller's method. TOL is the desired tolerance and N is the limit on the number of iterations to run, 0 means no limit. The function returns a vector [success,value,iteration], where success is a boolean indicating success, value is the last value computed, and iteration is the number of iterations done.

FindRootSecant
FindRootSecant (f,a,b,TOL,N)

Find root of a function using the secant method. TOL is the desired tolerance and N is the limit on the number of iterations to run, 0 means no limit. The function returns a vector [success,value,iteration], where success is a boolean indicating success, value is the last value computed, and iteration is the number of iterations done.

PolynomialRoots
PolynomialRoots (p)

Compute roots of a polynomial (degrees 1 through 4) using one of the formulas for such polynomials. The polynomial should be given as a vector of coefficients. That is 4*x^3 + 2*x + 1 corresponds to the vector [1,2,0,4]. Returns a column vector of the solutions.

The function calls QuadraticFormula, CubicFormula, and QuarticFormula.

QuadraticFormula
QuadraticFormula (p)

Compute roots of a quadratic (degree 2) polynomial using the quadratic formula. The polynomial should be given as a vector of coefficients. That is 3*x^2 + 2*x + 1 corresponds to the vector [1,2,3]. Returns a column vector of the two solutions.

See Planetmath or Mathworld for more information.

QuarticFormula
QuarticFormula (p)

Compute roots of a quartic (degree 4) polynomial using the quartic formula. The polynomial should be given as a vector of coefficients. That is 5*x^4 + 2*x + 1 corresponds to the vector [1,2,0,0,5]. Returns a column vector of the four solutions.

See Planetmath, Mathworld, or Wikipedia for more information.

RungeKutta
RungeKutta (f,x0,y0,x1,n)

Use classical non-adaptive fourth order Runge-Kutta method to numerically solve y'=f(x,y) for initial x0, y0 going to x1 with n increments, returns y at x1.

Systems can be solved by just having y be a (column) vector everywhere. That is, y0 can be a vector in which case f should take a number x and a vector of the same size for the second argument and should return a vector of the same size.

See Mathworld, or Wikipedia for more information.

RungeKuttaFull
RungeKuttaFull (f,x0,y0,x1,n)

Use classical non-adaptive fourth order Runge-Kutta method to numerically solve y'=f(x,y) for initial x0, y0 going to x1 with n increments, returns a 2 by n+1 matrix with the x and y values. Suitable for plugging into LinePlotDrawLine.

Systems can be solved by just having y be a (column) vector everywhere. That is, y0 can be a vector in which case f should take a number x and a vector of the same size for the second argument and should return a vector of the same size.

See Mathworld, or Wikipedia for more information.