private double FunctionValueHalfTime(INonlinearModel model, int rowVid, ValuesByIndex values, bool newValues) { foreach (Variable c in data.Variables) { if (c.ConstName == "T1/2") { c.ConstValue = values[model.GetIndexFromKey(c.ConstName)]; break; } } double R = data.Variables[0].ConstValue; double w = data.Variables[1].ConstValue; double Kon = data.Variables[2].ConstValue; double Koff = data.Variables[3].ConstValue; double Df = data.Variables[4].ConstValue; double Ceq = data.Variables[5].ConstValue; double Feq = 1 - Ceq; double Tht = data.Variables[6].ConstValue; data.FitYVals = new double[data.XVals.Length]; Laplace lap = new Laplace(); lap.InitStehfest(14); return(Math.Abs((R)*lap.InverseTransform(R, w, Feq, Ceq, Kon, Koff, Df, Tht) - 0.5 * R)); }
private static void SolveEq(DataSet data) { if (data.XVals.Length == 0 || data.Variables.Count == 0) { return; } double R = data.Variables[0].ConstValue; double w = data.Variables[1].ConstValue; double Kon = data.Variables[2].ConstValue; double Koff = data.Variables[3].ConstValue; double Df = data.Variables[4].ConstValue; double Ceq = data.Variables[5].ConstValue; double Feq = 1 - Ceq; data.FitYVals = new double[data.XVals.Length]; Laplace lap = new Laplace(); lap.InitStehfest(14); for (int t = 1; t < data.XVals.Length; t++) { //data.FitYVals[0][t] = MathNet.Numerics.SpecialFunctions.BesselK1(data.XVals[t]); //data.YVals[0][t] = MathNet.Numerics.SpecialFunctions.BesselI1(data.XVals[t]); //data.FitYVals[0][t] = Accord.Math.Bessel.I(data.XVals[t]); //data.FitYVals[0][t] = Accord.Math.Bessel.Y(data.XVals[t]); - it is not modified!!! data.FitYVals[t] = (R)*lap.InverseTransform(R, w, Feq, Ceq, Kon, Koff, Df, data.XVals[t]); } }