Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
zPowerExponentVariation.cs
1using System;
2using System.Numerics;
5
7{
12 {
17 : base(Parameter1, Parameter2, Start, Length, Expression)
18 {
19 }
20
25 : base(Parameter1, null, Start, Length, Expression)
26 {
27 }
28
29 private ZPowerExponentVariation(Complex z, ScriptNode Parameter, int Start, int Length, Expression Expression)
30 : base(z, Parameter, Start, Length, Expression)
31 {
32 }
33
34 private ZPowerExponentVariation(double Re, double Im, ScriptNode Parameter1, ScriptNode Parameter2,
36 : base(Re, Im, Parameter1, Parameter2, Start, Length, Expression)
37 {
38 }
39
44 {
45 if (Arguments[1] is null || Arguments[1].AssociatedObjectValue is null)
46 return new ZPowerExponentVariation(Expression.ToComplex(Arguments[0].AssociatedObjectValue), this.Arguments[0], this.Start, this.Length, this.Expression);
47 else
48 {
49 return new ZPowerExponentVariation(Expression.ToDouble(Arguments[0].AssociatedObjectValue), Expression.ToDouble(Arguments[1].AssociatedObjectValue),
50 this.Arguments[0], this.Arguments[1], this.Start, this.Length, this.Expression);
51 }
52 }
53
57 public override void Operate(ref double x, ref double y)
58 {
59 // (x+iy)^z
60
61 double lnz = Math.Log(Math.Sqrt(x * x + y * y));
62 double argz = Math.Atan2(y, x);
63 double amp = Math.Exp(this.re * lnz - this.im * argz);
64 double phi = this.im * lnz + this.re * argz;
65
66 x = amp * Math.Cos(phi);
67 y = amp * Math.Sin(phi);
68 }
69
73 public override string FunctionName => nameof(ZPowerExponentVariation);
74 }
75}
Class managing a script expression.
Definition: Expression.cs:39
static Complex ToComplex(object Object)
Converts an object to a complex value.
Definition: Expression.cs:4942
static double ToDouble(object Object)
Converts an object to a double value.
Definition: Expression.cs:4824
ZPowerExponentVariation(ScriptNode Parameter1, int Start, int Length, Expression Expression)
TODO
ZPowerExponentVariation(ScriptNode Parameter1, ScriptNode Parameter2, int Start, int Length, Expression Expression)
TODO
override IElement Evaluate(IElement[] Arguments, Variables Variables)
TODO
ScriptNode[] Arguments
Function arguments.
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
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Basic interface for all types of elements.
Definition: IElement.cs:20