public static Polynomial Parse(string ip) { MATHEMATICS math = new MATHEMATICS(12); string[] co = ip.Split(','); Polynomial res = new Polynomial(co.Length); for (int i = 0; i < co.Length; i++) { res[i] = math.EvaluateReal(co[i]); } return(res); }
public static Matrix Parse2(string ps) // Function parses the matrix from string { MATHEMATICS math = new MATHEMATICS(10); string s = NormalizeMatrixString(ps); string[] rows = ps.Split('\n'); string[] nums = rows[0].Split('\t'); Matrix matrix = new Matrix(rows.Length, nums.Length); try { for (int i = 0; i < rows.Length; i++) { nums = rows[i].Split('\t'); for (int j = 0; j < nums.Length; j++) { matrix[i, j] = math.EvaluateReal(nums[j]); } } } catch (FormatException) { throw new MException("Wrong input format!"); } return(matrix); }