Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
JuliaRoot2Variation.cs
1using System;
2using System.Numerics;
5
7{
12 {
16 public JuliaRoot2Variation(ScriptNode Parameter1, ScriptNode Parameter2, int Start, int Length, Expression Expression)
17 : base(Parameter1, Parameter2, Start, Length, Expression)
18 {
19 }
20
25 : base(Parameter1, null, Start, Length, Expression)
26 {
27 }
28
29 private JuliaRoot2Variation(Complex z, ScriptNode Parameter, int Start, int Length, Expression Expression)
30 : base(z, Parameter, Start, Length, Expression)
31 {
32 }
33
34 private JuliaRoot2Variation(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 {
47 return new JuliaRoot2Variation(Expression.ToComplex(Arguments[0].AssociatedObjectValue),
48 this.Arguments[0], this.Start, this.Length, this.Expression);
49 }
50 else
51 {
52 return new JuliaRoot2Variation(
53 Expression.ToDouble(Arguments[0].AssociatedObjectValue),
54 Expression.ToDouble(Arguments[1].AssociatedObjectValue),
55 this.Arguments[0], this.Arguments[1], this.Start, this.Length, this.Expression);
56 }
57 }
58
62 public override void Operate(ref double x, ref double y)
63 {
64 // -sqrt(x+iy-z)
65
66 double re = x - this.re;
67 double im = y - this.im;
68
69 double argz = Math.Atan2(im, re);
70 double amp = -Math.Pow(re * re + im * im, 0.25);
71 double phi = 0.5 * argz;
72
73 x = amp * Math.Cos(phi);
74 y = amp * Math.Sin(phi);
75 }
76
80 public override string FunctionName => nameof(JuliaRoot2Variation);
81 }
82}
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
JuliaRoot2Variation(ScriptNode Parameter1, int Start, int Length, Expression Expression)
TODO
JuliaRoot2Variation(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