00001 00002 // MathCore = a WYSIWYG equation editor + a powerful math engine // 00003 // Copyright (C) 2003 by Francesco Montorsi // 00004 // // 00005 // This library is free software; you can redistribute it and/or // 00006 // modify it under the terms of the GNU Lesser General Public // 00007 // License as published by the Free Software Foundation; either // 00008 // version 2.1 of the License, or (at your option) any later // 00009 // version. // 00010 // // 00011 // This library is distributed in the hope that it will be useful, // 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 00014 // GNU Lesser General Public License for more details. // 00015 // // 00016 // You should have received a copy of the GNU Lesser General Public // 00017 // License along with this program; if not, write to the Free // 00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, // 00019 // MA 02111-1307, USA. // 00020 // // 00021 // For any comment, suggestion or feature request, please contact // 00022 // the administrator of the project at frm@users.sourceforge.net // 00023 // // 00030 00031 00032 00033 #ifndef BISECTSOLVER_H 00034 #define BISECTSOLVER_H 00035 00036 // optimization for GCC compiler 00037 #ifdef __GNUG__ 00038 #pragma interface "BisectSolver.h" 00039 #endif 00040 00041 // required includes 00042 #include "mc/Solver.h" 00043 00044 00047 #define mcBISECTSOLVER_DEFAULT_DELTA mcRealValue(wxString(wxT("1e-10"))) 00048 00049 // this will be defined later 00050 class mcMathLine; 00051 00052 00055 class mcBisectSolver : public mcSolver 00056 { 00057 protected: 00058 00064 mcRealValue m_fDelta; 00065 00067 mcExtRange m_rStart; 00068 00069 protected: 00070 00077 mcRealValue math_Bisect(mcMathLine &tosolve, const mcSymbolProperties *unk, 00078 const mcRealValue &a, const mcRealValue &b, 00079 const mcRealValue &fa, const mcRealValue &fb); 00080 00084 mcRealValue math_Bisect(mcMathLine &tosolve, const mcSymbolProperties *unk, 00085 const mcRealValue &a, const mcRealValue &b); 00086 00087 public: 00088 mcBisectSolver() { 00089 m_strName = wxT("Bisection equation solver"); 00090 m_strDesc = wxT("Finds an approximated solution of all types of equations."); 00091 m_nType = mcST_BISECTION; 00092 m_fDelta = mcBISECTSOLVER_DEFAULT_DELTA; 00093 // m_rStart.DeepCopy(*mcRange::pR); 00094 } 00095 00096 virtual ~mcBisectSolver() {} 00097 00098 00103 bool math_SolveLine(mcMathLine &, const mcSymbolProperties *unk, 00104 mcSystemStepArray &); 00105 00108 bool math_WorksOn(const mcMathOrSystem &m) const; 00109 00110 00111 bool math_isReady() const; 00112 wxPanel *gui_GetOptionsPanel() const { return NULL; } 00113 00114 00117 void math_SetDelta(const mcRealValue &d) { m_fDelta=d; } 00118 00123 bool math_SetStartRange(const mcRange &r, const mcMathLine &p, 00124 const mcSymbolProperties *); 00125 }; 00126 00127 00128 #endif // BISECTSOLVER_H
[ Top ] |