Class Polynom
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))
Inheritance
System.Object
Polynom
Implements
System.Collections.Generic.IEnumerable<
monom>
System.Collections.IEnumerable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: CADability.dll
Syntax
public class Polynom : IEnumerable<monom>, IEnumerable
Constructors
|
Improve this Doc
View Source
Polynom(Double, Int32)
Creates a constant Polynom (often 1 or 0) with the provided dimension
Declaration
public Polynom(double cv, int dim)
Parameters
| Type |
Name |
Description |
| System.Double |
cv |
|
| System.Int32 |
dim |
|
|
Improve this Doc
View Source
Polynom(Int32, Int32)
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)
Declaration
public Polynom(int deg, int dim)
Parameters
| Type |
Name |
Description |
| System.Int32 |
deg |
the maximum degree
|
| System.Int32 |
dim |
number of variables
|
|
Improve this Doc
View Source
Polynom(Int32[], Double)
Creates a polynom with a single monom where m are the exponents and v is the facctor
Declaration
public Polynom(int[] m, double v)
Parameters
| Type |
Name |
Description |
| System.Int32[] |
m |
|
| System.Double |
v |
|
|
Improve this Doc
View Source
Polynom(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.
Declaration
public Polynom(params object[] def)
Parameters
| Type |
Name |
Description |
| System.Object[] |
def |
the definition of the polynom
|
Properties
|
Improve this Doc
View Source
Degree
Declaration
public int Degree { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
|
Improve this Doc
View Source
Dimension
Declaration
public int Dimension { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
|
Improve this Doc
View Source
LeadingTerm
Declaration
public int[] LeadingTerm { get; }
Property Value
| Type |
Description |
| System.Int32[] |
|
Methods
|
Improve this Doc
View Source
Add(Polynom)
Adds the provided Polynom to this Polynom. The degree of the provided Polynom may not exceed the degree of this Polynom.
Declaration
public void Add(Polynom b)
Parameters
|
Improve this Doc
View Source
Clone()
Declaration
Returns
|
Improve this Doc
View Source
Derivate(Int32[])
Declaration
public Polynom Derivate(params int[] diff)
Parameters
| Type |
Name |
Description |
| System.Int32[] |
diff |
|
Returns
|
Improve this Doc
View Source
Divide(Polynom, out Polynom)
Declaration
public Polynom Divide(Polynom devideBy, out Polynom remainder)
Parameters
Returns
|
Improve this Doc
View Source
Eval(Double[])
Inserts the values for the variables and calculates the result of the Polynom
Declaration
public double Eval(params double[] values)
Parameters
| Type |
Name |
Description |
| System.Double[] |
values |
|
Returns
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
Get(Int32[])
Declaration
public double Get(params int[] exp)
Parameters
| Type |
Name |
Description |
| System.Int32[] |
exp |
|
Returns
| Type |
Description |
| System.Double |
|
|
Improve this Doc
View Source
GetEnumerator()
Declaration
public IEnumerator<monom> GetEnumerator()
Returns
| Type |
Description |
| System.Collections.Generic.IEnumerator<monom> |
|
|
Improve this Doc
View Source
Integrate(Int32[])
Returns the integrated polynom
Declaration
public Polynom Integrate(params int[] intg)
Parameters
| Type |
Name |
Description |
| System.Int32[] |
intg |
variables to integrate
|
Returns
|
Improve this Doc
View Source
LagrangeReduction2(Polynom)
Declaration
public static ModOp2D LagrangeReduction2(Polynom polynom)
Parameters
| Type |
Name |
Description |
| Polynom |
polynom |
|
Returns
|
Improve this Doc
View Source
Modified(ModOp)
Modifies the Polynom (which must be 3-dimensional) by the provided Modop
Declaration
public Polynom Modified(ModOp m)
Parameters
| Type |
Name |
Description |
| ModOp |
m |
|
Returns
|
Improve this Doc
View Source
Modified(ModOp2D)
Modifies the Polynom (which must be 2-dimensional) by the provided Modop
Declaration
public Polynom Modified(ModOp2D m)
Parameters
Returns
|
Improve this Doc
View Source
NormalizeLeadingTerm()
Declaration
public void NormalizeLeadingTerm()
|
Improve this Doc
View Source
Offset(Double[])
Declaration
public Polynom Offset(params double[] off)
Parameters
| Type |
Name |
Description |
| System.Double[] |
off |
|
Returns
|
Improve this Doc
View Source
reduce()
Reduces the degree of the Polynom, when the highest degree of all terms is less than the degree of this Polynom.
Saves space.
Declaration
|
Improve this Doc
View Source
Reversed()
reverses all variables, replaces x by -x, y by -y, etc.
Declaration
public Polynom Reversed()
Returns
|
Improve this Doc
View Source
Roots()
Calculates the (real) roots of this Polynom. The Polynom must be 1-dimensional
Declaration
Returns
| Type |
Description |
| System.Double[] |
|
|
Improve this Doc
View Source
Set(Double, Int32[])
Sets the factor for the term specified by the parameter
Declaration
public void Set(double v, params int[] exp)
Parameters
| Type |
Name |
Description |
| System.Double |
v |
|
| System.Int32[] |
exp |
|
|
Improve this Doc
View Source
SingleDim(Double[])
Declaration
public static Polynom SingleDim(params double[] c)
Parameters
| Type |
Name |
Description |
| System.Double[] |
c |
|
Returns
|
Improve this Doc
View Source
SingleDimLinear(Double, Double)
Declaration
public static Polynom SingleDimLinear(double c0, double c1)
Parameters
| Type |
Name |
Description |
| System.Double |
c0 |
|
| System.Double |
c1 |
|
Returns
|
Improve this Doc
View Source
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
Declaration
public static List<double[]> SolveTwoSquared(Polynom p1, Polynom p2, double[] minmax = null)
Parameters
Returns
| Type |
Description |
| System.Collections.Generic.List<System.Double[]> |
|
|
Improve this Doc
View Source
Substitute(Polynom[])
Replaces the variables by new polynomes and calculates the resulting Polynom. The number of provided polynoms must macht the number of variables of this Polynom, which is the degree.
Declaration
public Polynom Substitute(params Polynom[] substWith)
Parameters
| Type |
Name |
Description |
| Polynom[] |
substWith |
|
Returns
|
Improve this Doc
View Source
SubstituteRational(Polynom, Polynom, Polynom, Polynom)
Declaration
public Polynom SubstituteRational(Polynom px, Polynom py, Polynom pz, Polynom pw)
Parameters
Returns
|
Improve this Doc
View Source
Subtract(Polynom)
Declaration
public Polynom Subtract(Polynom b)
Parameters
Returns
|
Improve this Doc
View Source
ToString()
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.Object.ToString()
Operators
|
Improve this Doc
View Source
Addition(Polynom, Polynom)
Adds two Polynoms, which must have the same dimension
Declaration
public static Polynom operator +(Polynom a, Polynom b)
Parameters
Returns
|
Improve this Doc
View Source
Addition(Polynom, Double)
Declaration
public static Polynom operator +(Polynom a, double b)
Parameters
| Type |
Name |
Description |
| Polynom |
a |
|
| System.Double |
b |
|
Returns
|
Improve this Doc
View Source
Addition(Double, Polynom)
Declaration
public static Polynom operator +(double b, Polynom a)
Parameters
| Type |
Name |
Description |
| System.Double |
b |
|
| Polynom |
a |
|
Returns
|
Improve this Doc
View Source
Division(Polynom, Double)
Declaration
public static Polynom operator /(Polynom b, double a)
Parameters
| Type |
Name |
Description |
| Polynom |
b |
|
| System.Double |
a |
|
Returns
|
Improve this Doc
View Source
ExclusiveOr(Polynom, Int32)
Declaration
public static Polynom operator ^(Polynom b, int n)
Parameters
| Type |
Name |
Description |
| Polynom |
b |
|
| System.Int32 |
n |
|
Returns
|
Improve this Doc
View Source
Multiply(Polynom, Polynom)
Multiplies two Polynoms, which must have the same dimension
Declaration
public static Polynom operator *(Polynom a, Polynom b)
Parameters
Returns
|
Improve this Doc
View Source
Multiply(Polynom, Double)
Declaration
public static Polynom operator *(Polynom b, double a)
Parameters
| Type |
Name |
Description |
| Polynom |
b |
|
| System.Double |
a |
|
Returns
|
Improve this Doc
View Source
Multiply(Double, Polynom)
Declaration
public static Polynom operator *(double a, Polynom b)
Parameters
| Type |
Name |
Description |
| System.Double |
a |
|
| Polynom |
b |
|
Returns
|
Improve this Doc
View Source
Subtraction(Polynom, Polynom)
Declaration
public static Polynom operator -(Polynom a, Polynom b)
Parameters
Returns
|
Improve this Doc
View Source
Subtraction(Polynom, Double)
Declaration
public static Polynom operator -(Polynom a, double b)
Parameters
| Type |
Name |
Description |
| Polynom |
a |
|
| System.Double |
b |
|
Returns
|
Improve this Doc
View Source
Subtraction(Double, Polynom)
Declaration
public static Polynom operator -(double b, Polynom a)
Parameters
| Type |
Name |
Description |
| System.Double |
b |
|
| Polynom |
a |
|
Returns
|
Improve this Doc
View Source
UnaryNegation(Polynom)
Declaration
public static Polynom operator -(Polynom a)
Parameters
Returns
Explicit Interface Implementations
|
Improve this Doc
View Source
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
| Type |
Description |
| System.Collections.IEnumerator |
|
Implements
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable