You are here: Symbol Reference > MtxIntDiff Namespace > Functions > MtxIntDiff.Romberg Function
MtxVec VCL
ContentsIndex
Example

Evaluate fuction Sin(x)*Exp(-x^2) on interval [0,PI/2] by using Romberg algorithm.

Uses Math387, MtxIntDiff; // Integrating function function IntFunc(const Parameters: TVec; const Constants: TVec; const ObjConst: Array of TObject): double; var x: double; begin x := Parameters[0]; IntFunc := Sin(x)*Exp(-x*x); end; // Integrate procedure DoIntegrate; var area: double; sr: TIntStopReason; begin area := Romberg(IntFunc,0,0.5*PI,sr); end;
#include "MtxExpr.hpp" #include "Math387.hpp" #include "MtxIntDiff.hpp" // Integrating function double __fastcall IntFun(TVec* const Parameters, TVec* const Constants, System::TObject* const * ObjConst, const int ObjConst_Size) { double x = (*Parameters)[0]; return Math.Sin(x)*Math.Exp(-x*x); } void __fastcall Example(); { TIntStopReason sr; double area = Romberg(IntFun,0.0,5*PI,NULL,NULL,sr); }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.