/// <summary>式を検証し、結果を返す。</summary> /// <param name="formula"></param> /// <param name="count"></param> /// <param name="formula_LastValid"></param> /// <param name="resultList"></param> /// <param name="isValid"></param> protected void ValidateFormula(string formula, int count, string formula_LastValid, double[] resultList, out bool isValid) { FormulaEngine engine = Application.FormulaEngine; double t; isValid = true; try { for (int i = 0; i < count; i++) { t = i / (double)(count - 1); resultList[i + 1] = engine.CalculateWithT(t, formula); } } catch (FormulaResultException) { isValid = false; for (int i = 0; i < count; i++) { t = i / (double)(count - 1); resultList[i + 1] = engine.CalculateWithT(t, formula_LastValid); } } try { t = -1.0 / (double)(count - 1); resultList[0] = engine.CalculateWithT(t, formula); } catch (FormulaResultException) { resultList[0] = resultList[1]; } try { t = count / (double)(count - 1); resultList[count + 1] = engine.CalculateWithT(t, formula); } catch (FormulaResultException) { resultList[count + 1] = resultList[count]; } }