Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Tan.cs
1using System;
2using System.Numerics;
7
9{
14 {
24 {
25 }
26
30 public override string FunctionName => nameof(Tan);
31
38 public ScriptNode Differentiate(string VariableName, Variables Variables)
39 {
40 if (VariableName == this.DefaultVariableName)
41 {
42 int Start = this.Start;
43 int Len = this.Length;
45
46 return this.DifferentiationChainRule(VariableName, Variables, this.Argument,
47 new Square(
48 new Sec(this.Argument, Start, Len, Exp),
49 Start, Len, Exp));
50 }
51 else
52 return new ConstantElement(DoubleNumber.ZeroElement, this.Start, this.Length, this.Expression);
53 }
54
62 {
63 return new DoubleNumber(Math.Tan(Argument));
64 }
65
73 {
74 return new ComplexNumber(Complex.Tan(Argument));
75 }
76 }
77}
Class managing a script expression.
Definition: Expression.cs:39
Tan(ScriptNode Argument, int Start, int Length, Expression Expression)
Tan(x)
Definition: Tan.cs:22
ScriptNode Differentiate(string VariableName, Variables Variables)
Differentiates a script node, if possible.
Definition: Tan.cs:38
override IElement EvaluateScalar(Complex Argument, Variables Variables)
Evaluates the function on a scalar argument.
Definition: Tan.cs:72
override IElement EvaluateScalar(double Argument, Variables Variables)
Evaluates the function on a scalar argument.
Definition: Tan.cs:61
override string FunctionName
Name of the function
Definition: Tan.cs:30
Represents a constant element value.
Base class for funcions of one scalar variable.
ScriptNode Argument
Function argument.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
ScriptNode DifferentiationChainRule(string VariableName, Variables Variables, ScriptNode Argument, ScriptNode Differentiation)
Implements the differentiation chain rule, by differentiating the argument and multiplying it to the ...
Definition: ScriptNode.cs:195
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
static readonly DoubleNumber ZeroElement
0
Definition: DoubleNumber.cs:16
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20
Base interface for lambda expressions.
string DefaultVariableName
Default variable name, if any, null otherwise.