public override FunctionElement SetVariableValue(string name, FunctionElement e) { Function newF = new Function(); this.variables.ForEach(v => newF += v.SetVariableValue(name, e)); //newF.Degree = this.Degree; //newF.Functions = new List<MathFunctions.IMathFunction>(this.Functions); newF.ForceAddFunctions(this); foreach (var mf in newF.MathFunctions) { for (int i = 0; i < mf.Item2.Length; i++) { mf.Item2[i] = mf.Item2[i].SetVariableValue(name, e); } } return newF.Recalc(); }