Class Functions
Supporting functions for behavioral models.
Inheritance
Inherited Members
Namespace: SpiceSharpBehavioral.Builders
Assembly: SpiceSharpBehavioral.dll
Syntax
public static class Functions
Methods
Equals(Double, Double, Double, Double)
Checks if two numbers are equal.
Declaration
public static bool Equals(double left, double right, double relTol, double absTol)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | left | The left argument. |
| System.Double | right | The right argument. |
| System.Double | relTol | The relative tolerance. |
| System.Double | absTol | The absolute tolerance. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Log(Double)
Takes the natural logarithm.
Declaration
public static double Log(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double | The natural logarithm. |
Log10(Double)
Takes the logarithm base 10.
Declaration
public static double Log10(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double | The logarithm baes 10. |
Power(Double, Double)
Raises a number to a power. The function is made symmetrical.
Declaration
public static double Power(double left, double right)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | left | The left argument. |
| System.Double | right | The right argument. |
Returns
| Type | Description |
|---|---|
| System.Double | The result. |
Power2(Double, Double)
Raises a number to a power. The function is made antisymmetrical.
Declaration
public static double Power2(double left, double right)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | left | The left argument. |
| System.Double | right | The right argument. |
Returns
| Type | Description |
|---|---|
| System.Double | The result. |
Pwl(Double, Point[])
Piece-wise linear interpolation.
Declaration
public static double Pwl(double arg, Point[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
| Point[] | data | The interpolation data. |
Returns
| Type | Description |
|---|---|
| System.Double | The interpolated value. |
PwlDerivative(Double, Point[])
The derivative of Pwl(Double, Point[]).
Declaration
public static double PwlDerivative(double arg, Point[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
| Point[] | data | The interpolation data. |
Returns
| Type | Description |
|---|---|
| System.Double | The interpolated value. |
Ramp(Double)
The ramp function.
Declaration
public static double Ramp(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double | The result. |
RampDerivative(Double)
The derivative of RampDerivative(Double)
Declaration
public static double RampDerivative(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double |
SafeDivide(Double, Double, Double)
Divides two numbers while avoiding division by 0 using a fudge factor.
Declaration
public static double SafeDivide(double left, double right, double fudgeFactor)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | left | The left argument. |
| System.Double | right | The right argument. |
| System.Double | fudgeFactor | The fudge factor. |
Returns
| Type | Description |
|---|---|
| System.Double | The division. |
Sign(Double)
Returns the sign of the argument.
Declaration
public static double Sign(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double | -1.0 if negative; 1.0 if positive; otherwise 0.0. |
Sqrt(Double)
Calculates the square root of a number.
Declaration
public static double Sqrt(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double | The result. |
Square(Double)
Squares a value.
Declaration
public static double Square(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double | The result. |
Step(Double)
The step function.
Declaration
public static double Step(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double | The result. |
Step2(Double)
The step function with an initial ramp.
Declaration
public static double Step2(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double | The result. |
Step2Derivative(Double)
The derivative of Step2(Double).
Declaration
public static double Step2Derivative(double arg)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | arg | The argument. |
Returns
| Type | Description |
|---|---|
| System.Double |