public void Integrate() { var dlg = new Integrate(Expressions.CurrentExpression); dlg.Ok += Integrate_Ok; dlg.ShowDialog(); }
void Integrate_Ok(Integrate.IntegrationDialogResponse Response) { var antiderivative = Antiderive(Response.Expression).Replace("y=", ""); // pretty highlighting Expressions.Add(string.Format("y<({0})&y>0&x>{1}&x<{2}", Response.Expression, Response.XMin, Response.XMax)); Expressions.Add(string.Format("y>({0})&y<0&x>{1}&x<{2}", Response.Expression, Response.XMin, Response.XMax)); // calculating the signed area bound by the x axis var min_sub_in = Expressions.SubIn(antiderivative, "x", Response.XMin.ToString()); var max_sub_in = Expressions.SubIn(antiderivative, "x", Response.XMax.ToString()); Expressions.Add(string.Format("({0})-({1})", max_sub_in, min_sub_in)); }