Show / Hide Table of Contents

Class Derivatives

A class that can derive an expression node tree.

Inheritance
System.Object
Derivatives
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: SpiceSharpBehavioral.Parsers.Nodes
Assembly: SpiceSharpBehavioral.dll
Syntax
public class Derivatives

Constructors

Derivatives(VariableNode[])

Initializes a new instance of the Derivatives class.

Declaration
public Derivatives(params VariableNode[] variables)
Parameters
Type Name Description
VariableNode[] variables

The variables.

Derivatives(IEnumerable<VariableNode>)

Initializes a new instance of the Derivatives class.

Declaration
public Derivatives(IEnumerable<VariableNode> variables)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<VariableNode> variables

The variables to which the derivative should be computed.

Properties

FunctionRules

Gets or sets derivative definitions.

Declaration
public Dictionary<string, FunctionRule> FunctionRules { get; set; }
Property Value
Type Description
System.Collections.Generic.Dictionary<System.String, FunctionRule>

The derivative definitions.

Variables

Gets the map.

Declaration
public HashSet<VariableNode> Variables { get; }
Property Value
Type Description
System.Collections.Generic.HashSet<VariableNode>

The map.

Methods

Apply(Dictionary<VariableNode, Node>, Func<Node, Node>)

Applies the specified argument.

Declaration
public static Dictionary<VariableNode, Node> Apply(Dictionary<VariableNode, Node> argument, Func<Node, Node> func)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<VariableNode, Node> argument

The argument.

System.Func<Node, Node> func

The function.

Returns
Type Description
System.Collections.Generic.Dictionary<VariableNode, Node>

ChainRule(FunctionNode, IReadOnlyList<Node>, String)

Applies the chain rule on a function.

Declaration
public static Node ChainRule(FunctionNode function, IReadOnlyList<Node> dargs, string format)
Parameters
Type Name Description
FunctionNode function

The function definition.

System.Collections.Generic.IReadOnlyList<Node> dargs

The derivatives of the arguments.

System.String format

The format of the new function. {0} denotes the old name, while {1} will hold the index to which the function should be derived.

Returns
Type Description
Node

Combine(Dictionary<VariableNode, Node>, Dictionary<VariableNode, Node>, Func<Node, Node>, Func<Node, Node>, Func<Node, Node, Node>)

Combines two arguments together.

Declaration
public static Dictionary<VariableNode, Node> Combine(Dictionary<VariableNode, Node> left, Dictionary<VariableNode, Node> right, Func<Node, Node> leftOnly, Func<Node, Node> rightOnly, Func<Node, Node, Node> both = null)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<VariableNode, Node> left

The left argument.

System.Collections.Generic.Dictionary<VariableNode, Node> right

The right argument.

System.Func<Node, Node> leftOnly

The function called when the left argument is not zero.

System.Func<Node, Node> rightOnly

The function called when the right argument is not zero.

System.Func<Node, Node, Node> both

The function called when both arguments are not zero.

Returns
Type Description
System.Collections.Generic.Dictionary<VariableNode, Node>

The result.

Derive(Node)

Derives the specified node to the variables.

Declaration
public virtual Dictionary<VariableNode, Node> Derive(Node node)
Parameters
Type Name Description
Node node

The nodes.

Returns
Type Description
System.Collections.Generic.Dictionary<VariableNode, Node>

The derived nodes, or null if all derivatives are zero.

Back to top Generated by DocFX