private void Cal_Click(object sender, RoutedEventArgs e) { char[] separator = new[] { ',', '\n' }; var equ = equation.Text.Split(separator); Equation ourEquations = new Equation(equ); if (equ.Length == 2) { CoordinatePlane.SizeX = drawequplane.ActualWidth; CoordinatePlane.SizeY = drawequplane.ActualHeight; var first = Function.EquationFunc(ourEquations, 0); var second = Function.EquationFunc(ourEquations, 1); ourEquations.Results(); CoordinatePlane plane = new CoordinatePlane(equplane, (int)ourEquations.MyResult[0, 0] - 3, (int)ourEquations.MyResult[1, 0] - 3, (int)ourEquations.MyResult[0, 0] + 3, (int)ourEquations.MyResult[1, 0] + 3); equplane.Background = Brushes.White; plane.SetProperty(); plane.DrawPlane(); plane.DrawFunction(first, Brushes.Tomato); plane.DrawFunction(second, Brushes.DarkSlateBlue); _screen = plane; _screen.GridColor = main.Background; } string myresult = ourEquations.Results(); Result.Text = myresult; }
public void DrawPlane(Grid drawingGrid) { this.Plane = new CoordinatePlane(drawingGrid, Functions); Plane.Setting_X_Axis(); Plane.Setting_Y_Axis(); Plane.DefineColumn(); Plane.DefineRow(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { CoordinatePlane.SizeX = drawplane.ActualWidth; CoordinatePlane.SizeY = drawplane.ActualHeight; CoordinatePlane plane = new CoordinatePlane(Myplane, int.Parse(MinX.Text), int.Parse(Miny.Text), int.Parse(MaxX.Text), int.Parse(MaxY.Text)); Myplane.Background = Brushes.White; plane.SetProperty(); plane.DrawPlane(); Function function = new Function(DrawFunction.Text); plane.DrawFunction(function.ParsedFunc, Brushes.Black); _screen = plane; _screen.GridColor = main.Background; }
private void DrawTaylor_Click(object sender, RoutedEventArgs e) { CoordinatePlane.SizeX = taylorgrid.ActualWidth; CoordinatePlane.SizeY = taylorgrid.ActualHeight; Function sinFunction = new Function("sinx"); Func <double, double> series = TaylorSeries.MakeTaylorSeries(int.Parse(Number.Text), double.Parse(Point.Text), 1, 0); var minspan = TaylorSeries.DetermineSinSpanMin(sinFunction.ParsedFunc, series, int.Parse(Point.Text)); var maxspan = TaylorSeries.DetermineSinSpanMax(sinFunction.ParsedFunc, series, int.Parse(Point.Text)); var diff = maxspan - minspan; CoordinatePlane taylor = new CoordinatePlane(TaylorPlane, minspan - diff / 2, -2, maxspan + diff / 2, 2); taylor.SetProperty(); _taylorCoordinatePlane = taylor; taylor.DrawPlane(); taylor.DrawFunction(sinFunction.ParsedFunc, Brushes.Black); TaylorPlane.Background = Brushes.White; taylor.DrawFunction(series, Brushes.PaleVioletRed); }