public static void Main() { PolyFunc <double, double> l1 = new PolyFunc <double, double>(1); PolyFunc <double, double> l2 = new PolyFunc <double, double>(2); IntegrableFunction <double, double> split = IntegrableFunction <double, double> .SplitAt(l1, 2, l2, false); for (double d = 0; d < 5; d += 0.1) { Console.WriteLine("<{0},{1},{2},{3},{4}>", d, l1.F(d), l2.F(d), split.F(d), split.FI(d)); } Console.ReadKey(); }
private void buttonDraw_Click(object sender, RoutedEventArgs e) { // dataGridGx.Items.Refresh(); if (SafeParse(textBoxXMin.Text) >= SafeParse(textBoxXMax.Text)) { if (SafeParse(textBoxXMin.Text) == SafeParse(textBoxXMax.Text) || SafeParse(textBoxXMax.Text) - SafeParse(textBoxXMin.Text) < 1) { MessageBox.Show("Incorrect drawing range by x-axis!\nNeed xMin < xMax and xMax - yMin >= 1", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } string temp = textBoxXMin.Text; textBoxXMin.Text = textBoxXMax.Text; textBoxXMax.Text = temp; } double xMin = SafeParse(textBoxXMin.Text); double xMax = SafeParse(textBoxXMax.Text); if (SafeParse(textBoxYMin.Text) >= SafeParse(textBoxYMax.Text)) { if (SafeParse(textBoxYMin.Text) == SafeParse(textBoxYMax.Text) || SafeParse(textBoxYMax.Text) - SafeParse(textBoxYMin.Text) < 1) { MessageBox.Show("Incorrect drawing range by y-axis!\nNeed yMin < yMax and yMax - yMin >= 1", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } string temp = textBoxYMin.Text; textBoxYMin.Text = textBoxYMax.Text; textBoxYMax.Text = temp; } double yMin = SafeParse(textBoxYMin.Text); double yMax = SafeParse(textBoxYMax.Text); CanvasBuilder.ClearCanvas(canvas); CanvasBuilder.DrawGrid(canvas, xMax, xMin, yMax, yMin); pf.StringFunction = textBoxFunc.Text; if (pf.CheckFunc()) { CanvasBuilder.DrawFunction(canvas, Brushes.Blue, pf.F); } foreach (double i in solutions) { CanvasBuilder.DrawPoint(canvas, Brushes.Green, 13, i, pf.F(i)); } }