public void setMain(DifferenceTable mainTable) { xmin = (float)mainTable.getX(0); xmax = (float)mainTable.getX(mainTable.n); ymin = (float)mainTable.getY(0); for (int i = 1; i <= mainTable.n; i++) { ymin = (ymin < (float)mainTable.getY(i)) ? ymin : (float)mainTable.getY(i); } ymax = (float)mainTable.getY(0); for (int i = 1; i <= mainTable.n; i++) { ymax = (ymax > (float)mainTable.getY(i)) ? ymax : (float)mainTable.getY(i); } float q = (xmax - xmin) * 0.1F; xmin -= q; xmax += q; q = (ymax - ymin) * 0.1F; ymin -= q; ymax += q; }
public void AddFunction(Polynomial P, Pen pen) { DifferenceTable table = new DifferenceTable(control, 200, "", false, false, false); table.setTable_Polynomial(P, xmin, xmax); PointsList.Add(table.ToPoints()); PensList.Add(pen); }
private void button_Func_GetValue_Click(object sender, EventArgs e) { int nbPoints; double a, b; string expression = textBox_Func_fx.Text; if (!int.TryParse(textBox_Function_nbPoints.Text, out nbPoints) || nbPoints <= 1) { MessageBox.Show("Invalid integer number of points larger than 1 !", "Error !"); textBox_Function_nbPoints.Focus(); textBox_Function_nbPoints.SelectAll(); return; } if (!double.TryParse(textBox_Function_a.Text, out a)) { MessageBox.Show("Invalid double value in (a) !", "Error !"); textBox_Function_a.Focus(); textBox_Function_a.SelectAll(); return; } if (!double.TryParse(textBox_Function_b.Text, out b) || b == a) { MessageBox.Show("Invalid double value in (b) or is equal to (a) !", "Error !"); textBox_Function_b.Focus(); textBox_Function_b.SelectAll(); return; } if (!validExpression(expression)) { MessageBox.Show("Invalid function !", "Error !"); textBox_Func_fx.Focus(); textBox_Func_fx.SelectAll(); return; } table_Integration = new DifferenceTable(table2Panel.Controls, nbPoints, "myIntegrationTableHelp", false, false); table_Integration.setTable_Expression(expression, a, b); groupBox_Integration_Table.Enabled = true; groupBox_Integration_Result.Enabled = false; }
private void submitBtn_Click(object sender, EventArgs e) { int n = 0; if (!int.TryParse(nbPointsTextBox.Text, out n) || n <= 1) { MessageBox.Show("Please enter a valid integer value bigger than 1 !", "Error !"); nbPointsTextBox.Focus(); nbPointsTextBox.SelectAll(); return; } table1Panel.Controls.Clear(); table_Interpolation = new DifferenceTable(table1Panel.Controls, n, "myInterpolationTable"); //nbPointsTextBox.Enabled = false; //submitBtn.Enabled = false; table1GroupBox.Enabled = true; functionBtn.Enabled = true; }
public void AddIntegrationPoints(DifferenceTable table, Pen pen) { IntegrationPointsList.Add(table.ToPoints()); IntegrationPensList.Add(pen); }
public void AddPoints(DifferenceTable table, Pen pen) { OnlyPointsList.Add(table.ToPoints()); OnlyPensList.Add(pen); }
public void AddFunction(DifferenceTable table, Pen pen) { PointsList.Add(table.ToPoints()); PensList.Add(pen); }