Table of Contents

Class Polynom

Namespace
CADability
Assembly
CADability.dll

A Polynom in multiple variables, often named x,y,z, but may be any dimension. e.g. ax³ + bx²y + cxy² +dy³ + ex² + fxy + gy² + hx + iy + j (deg(ree)==3, dim(ension)==2: (x,y))

public class Polynom : IEnumerable<monom>, IEnumerable
Inheritance
Polynom
Implements
Inherited Members
Extension Methods

Constructors

Polynom(double, int)

Creates a constant Polynom (often 1 or 0) with the provided dimension

public Polynom(double cv, int dim)

Parameters

cv double
dim int

Polynom(int, int)

Creates an empty polynom with all coefficients set to 0, prepared to have a maximum degree of deg and a dimension of dim (number of variables)

public Polynom(int deg, int dim)

Parameters

deg int

the maximum degree

dim int

number of variables

Polynom(int[], double)

Creates a polynom with a single monom where m are the exponents and v is the facctor

public Polynom(int[] m, double v)

Parameters

m int[]
v double

Polynom(params object[])

Creates a polynom as specified by the parameters. Expects input like (3, "x2", 4, "x", 5, "", 6, "y2", 7, "z", 8, "x2y") a alternating sequence of double values and strings. The charcters in the strings are interpreted as follows: A letter, which is the name of the variable, followed by an optional digit, which is the exponent of the variable (when missing "1" is assumed). An empty string is for the constant. The number of different variable names defines the dimension. The highest degree is derived from the exponents. The indices of the variables are in alphabetical order. The variable names have no further meaning and are not conserved.

public Polynom(params object[] def)

Parameters

def object[]

the definition of the polynom

Properties

Degree

public int Degree { get; }

Property Value

int

Dimension

public int Dimension { get; }

Property Value

int

LeadingTerm

public int[] LeadingTerm { get; }

Property Value

int[]

Methods

Add(Polynom)

Adds the provided Polynom to this Polynom. The degree of the provided Polynom may not exceed the degree of this Polynom.

public void Add(Polynom b)

Parameters

b Polynom

Clone()

public Polynom Clone()

Returns

Polynom

Derivate(params int[])

public Polynom Derivate(params int[] diff)

Parameters

diff int[]

Returns

Polynom

Divide(Polynom, out Polynom)

public Polynom Divide(Polynom devideBy, out Polynom remainder)

Parameters

devideBy Polynom
remainder Polynom

Returns

Polynom

Eval(params double[])

Inserts the values for the variables and calculates the result of the Polynom

public double Eval(params double[] values)

Parameters

values double[]

Returns

double

Get(params int[])

public double Get(params int[] exp)

Parameters

exp int[]

Returns

double

GetEnumerator()

public IEnumerator<monom> GetEnumerator()

Returns

IEnumerator<monom>

Integrate(params int[])

Returns the integrated polynom

public Polynom Integrate(params int[] intg)

Parameters

intg int[]

variables to integrate

Returns

Polynom

LagrangeReduction2(Polynom)

public static ModOp2D LagrangeReduction2(Polynom polynom)

Parameters

polynom Polynom

Returns

ModOp2D

Modified(ModOp)

Modifies the Polynom (which must be 3-dimensional) by the provided Modop

public Polynom Modified(ModOp m)

Parameters

m ModOp

Returns

Polynom

Modified(ModOp2D)

Modifies the Polynom (which must be 2-dimensional) by the provided Modop

public Polynom Modified(ModOp2D m)

Parameters

m ModOp2D

Returns

Polynom

NormalizeLeadingTerm()

public void NormalizeLeadingTerm()

Offset(params double[])

public Polynom Offset(params double[] off)

Parameters

off double[]

Returns

Polynom

Reversed()

reverses all variables, replaces x by -x, y by -y, etc.

public Polynom Reversed()

Returns

Polynom

Roots()

Calculates the (real) roots of this Polynom. The Polynom must be 1-dimensional

public double[] Roots()

Returns

double[]

Set(double, params int[])

Sets the factor for the term specified by the parameter

public void Set(double v, params int[] exp)

Parameters

v double
exp int[]

SingleDim(params double[])

public static Polynom SingleDim(params double[] c)

Parameters

c double[]

Returns

Polynom

SingleDimLinear(double, double)

public static Polynom SingleDimLinear(double c0, double c1)

Parameters

c0 double
c1 double

Returns

Polynom

SolveTwoSquared(Polynom, Polynom, double[])

Sloves two polynoms (==0) of degree 2 and dimension 2. the optinal minmax parameter gives bounds for the first (index 0,1) and the second (indes 2,3) variable

public static List<double[]> SolveTwoSquared(Polynom p1, Polynom p2, double[] minmax = null)

Parameters

p1 Polynom
p2 Polynom
minmax double[]

Returns

List<double[]>

Substitute(params Polynom[])

Replaces the variables by new polynomes and calculates the resulting Polynom. The number of provided polynoms must match the number of variables of this Polynom, which is the degree.

public Polynom Substitute(params Polynom[] substWith)

Parameters

substWith Polynom[]

Returns

Polynom

SubstituteRational(Polynom, Polynom, Polynom, Polynom)

public Polynom SubstituteRational(Polynom px, Polynom py, Polynom pz, Polynom pw)

Parameters

px Polynom
py Polynom
pz Polynom
pw Polynom

Returns

Polynom

Subtract(Polynom)

public Polynom Subtract(Polynom b)

Parameters

b Polynom

Returns

Polynom

ToString()

public override string ToString()

Returns

string

reduce()

Reduces the degree of the Polynom, when the highest degree of all terms is less than the degree of this Polynom. Saves space.

public void reduce()

Operators

operator +(Polynom, Polynom)

Adds two Polynoms, which must have the same dimension

public static Polynom operator +(Polynom a, Polynom b)

Parameters

a Polynom
b Polynom

Returns

Polynom

operator +(Polynom, double)

public static Polynom operator +(Polynom a, double b)

Parameters

a Polynom
b double

Returns

Polynom

operator +(double, Polynom)

public static Polynom operator +(double b, Polynom a)

Parameters

b double
a Polynom

Returns

Polynom

operator /(Polynom, double)

public static Polynom operator /(Polynom b, double a)

Parameters

b Polynom
a double

Returns

Polynom

operator ^(Polynom, int)

public static Polynom operator ^(Polynom b, int n)

Parameters

b Polynom
n int

Returns

Polynom

operator *(Polynom, Polynom)

Multiplies two Polynoms, which must have the same dimension

public static Polynom operator *(Polynom a, Polynom b)

Parameters

a Polynom
b Polynom

Returns

Polynom

operator *(Polynom, double)

public static Polynom operator *(Polynom b, double a)

Parameters

b Polynom
a double

Returns

Polynom

operator *(double, Polynom)

public static Polynom operator *(double a, Polynom b)

Parameters

a double
b Polynom

Returns

Polynom

operator -(Polynom, Polynom)

public static Polynom operator -(Polynom a, Polynom b)

Parameters

a Polynom
b Polynom

Returns

Polynom

operator -(Polynom, double)

public static Polynom operator -(Polynom a, double b)

Parameters

a Polynom
b double

Returns

Polynom

operator -(double, Polynom)

public static Polynom operator -(double b, Polynom a)

Parameters

b double
a Polynom

Returns

Polynom

operator -(Polynom)

public static Polynom operator -(Polynom a)

Parameters

a Polynom

Returns

Polynom