日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

OpenCASCADE Gauss Integration

系統(tǒng) 2318 0

OpenCASCADE Gauss Integration

eryar@163.com

Abstract. Numerical integration is the approximate computation of an integral using numerical techniques. The numerical computation of an integral is sometimes called quadrature. The most straightforward numerical integration technique uses the Newton-Cotes formulas(also called quadrature formulas), which approximate a function tabulated sequence of regularly spaced intervals by various degree polynomials. If the functions are known analytically instead of being tabulated at equally spaced intervals, the best numerical method of integrations is called Gauss Integration(Gaussian quadrature). By picking the abscissas at which to evaluate the function, Gaussian quadrature produces the most accurate approximations possible. In OpenCASCADE math package it implement the Gauss-Legendre integration. So I will focus on the usage of the class in OpenCASCADE.?

Key Words . OpenCASCADE, Gauss Integration, Gauss-Legendre, Numerical Analysis

1. Introduction

在科學(xué)和工程計(jì)算問題中,經(jīng)常要計(jì)算一些定積分或微分,它們的精確值無法算出或計(jì)算量太大,只能用數(shù)值的方法給出具有指定誤差限的近似值。最直觀的數(shù)值積分方法有Newton-Cotes,其將積分區(qū)間等分之,并取分點(diǎn)為積分節(jié)點(diǎn)。這種做法雖然簡(jiǎn)化了計(jì)算,但卻降低了所得公式的代數(shù)精度。?

Gauss型求積公式是一種高精度的數(shù)值積分公式。在求積節(jié)點(diǎn)數(shù)相同的情況下,即計(jì)算工作量相近的情況下,利用Gauss型求積公式往往可以獲得準(zhǔn)確程序較高的積分結(jié)果,只是它在不等距的無理數(shù)上計(jì)算被積函數(shù)。?

OpenCASCADE的math包中實(shí)現(xiàn)了Gauss-Legendre積分算法。本文主要介紹其使用方法,進(jìn)而對(duì)其應(yīng)用進(jìn)行理解。

2. The Gauss-Legendre Integration

Gauss型求積公式是數(shù)值穩(wěn)定的,且對(duì)有限閉區(qū)間上的連續(xù)函數(shù),Gauss求積的數(shù)值隨節(jié)點(diǎn)數(shù)目的增加而收斂到準(zhǔn)確積分值。?

常用的Gauss型求積公式有Gauss-Legendre求積公式,Gauss-Chebyshev求積公式,Gauss-Laguerre求積公式和Gauss-Hermite求積公式等。?

對(duì)于一般區(qū)間[a, b]上的Gauss型求積公式,可通過變量變換,由Gauss-Legendre求積公式得到:?

wps_clip_image-12252 其中:?

wps_clip_image-28519

OpenCASCADE中對(duì)應(yīng)的類有math_GaussSingleIntegration,主要實(shí)現(xiàn)的函數(shù)為Perform(),計(jì)算過程如下:?

v 查表求得Gauss點(diǎn)及求積系數(shù);

      
        //
      
      
        Recuperation des points de Gauss dans le fichier GaussPoints.
      
      
          math::GaussPoints(Order,GaussP);

  math::GaussWeights(Order,GaussW);
      
    

v 根據(jù)Gauss-Legendre求積公式計(jì)算;?

?

      
        //
      
      
         Changement de variable pour la mise a l'echelle [Lower, Upper] :
      
      

  xm = 
      
        0.5
      
      *(Upper +
      
         Lower);

  xr 
      
      = 
      
        0.5
      
      *(Upper -
      
         Lower);

  Val 
      
      = 
      
        0
      
      
        .;



  Standard_Integer ind 
      
      = Order/
      
        2
      
      , ind1 = (Order+
      
        1
      
      )/
      
        2
      
      
        ;

  
      
      
        if
      
      (ind1 > ind) { 
      
        //
      
      
         odder case
      
      

    Ok1 =
      
         F.Value(xm, Val);

    
      
      
        if
      
       (!Ok1) 
      
        return
      
      
        ;

    Val 
      
      *=
      
         GaussW(ind1);

  }


      
      
        //
      
      
         Sommation sur tous les points de Gauss: avec utilisation de la symetrie.
      
      
        for
      
       (j = 
      
        1
      
      ; j <= ind; j++
      
        ) {

    dx 
      
      = xr*
      
        GaussP(j);

    Ok1 
      
      = F.Value(xm-
      
        dx, F1);

    
      
      
        if
      
      (!Ok1) 
      
        return
      
      
        ;

    Ok1 
      
      = F.Value(xm+
      
        dx, F2);

    
      
      
        if
      
      (!Ok1) 
      
        return
      
      
        ;

    
      
      
        //
      
      
         Multiplication par les poids de Gauss.
      
      

    Standard_Real FT = F1+
      
        F2;

    Val 
      
      += GaussW(j)*
      
        FT;  

  }

  
      
      
        //
      
      
         Mise a l'echelle de l'intervalle [Lower, Upper]
      
      

  Val *= xr;
    

對(duì)比Gauss-Legendre求積公式來理解上述代碼還是比較清晰的。下面給出使用此類的一個(gè)具體實(shí)例:?

      
        /*
      
      
        

*    Copyright (c) 2014 eryar All Rights Reserved.

*

*        File    : Main.cpp

*        Author  : eryar@163.com

*        Date    : 2014-09-11 20:46

*        Version : 1.0v

*

*    Description : Demo for Gauss-Legendre Integration usage.

*

*      Key words : OpenCascade, Gauss-Legendre Integration


      
      
        */
      
      
        #define
      
       WNT
      
        

#include 
      
      <math_Function.hxx>
      
        

#include 
      
      <math_GaussSingleIntegration.hxx>




      
        #pragma
      
       comment(lib, "TKernel.lib")


      
        #pragma
      
       comment(lib, "TKMath.lib")




      
        class
      
       Test_GaussFunction : 
      
        public
      
      
         math_Function

{


      
      
        public
      
      
        :

    
      
      
        virtual
      
       Standard_Boolean Value(
      
        const
      
       Standard_Real x, Standard_Real &
      
        y)

    {

        y 
      
      =
      
         x;



        
      
      
        return
      
      
         Standard_True;

    }




      
      
        private
      
      
        :

};




      
      
        void
      
       TestGaussIntegration(
      
        void
      
      
        )

{

    Test_GaussFunction aFunction;

    math_GaussSingleIntegration aSolver(aFunction, 
      
      
        1
      
      , 
      
        10
      
      , 
      
        10
      
      
        );



    std::cout 
      
      << aSolver <<
      
         std::endl;

}




      
      
        int
      
       main(
      
        int
      
       argc, 
      
        char
      
      *
      
         argv[])

{

    TestGaussIntegration();



    
      
      
        return
      
      
        0
      
      
        ;

}
      
    

主要是從math_Function派生一個(gè)類來在虛函數(shù)Value()中重定義求積函數(shù)即可。上述實(shí)例中計(jì)算的是如下積分:?

wps_clip_image-4533

計(jì)算結(jié)果如下圖所示:?

wps_clip_image-15082

Figure 2.1 Gauss-Legendre Integtation Result?

3. Application

由高等數(shù)學(xué)知識(shí)可知,積分的應(yīng)用主要用于計(jì)算圖形面積,體積及曲線的弧長(zhǎng),功等。?

積分在OpenCASCADE中的主要應(yīng)用有計(jì)算曲線長(zhǎng)度,曲面面積及實(shí)體的體積等。如下圖所示:?

wps_clip_image-13853

Figure 3.1 Compute Area of a Surface?

示例代碼如下所示:

      TopoDS_Shape S =
      
         BRepBuilderAPI_MakeFace(BSS, Precision::Confusion()).Face();



GProp_GProps System;

BRepGProp::SurfaceProperties(S,System);

gp_Pnt G 
      
      =
      
         System.CentreOfMass ();

Standard_Real Area 
      
      =
      
         System.Mass();

gp_Mat I 
      
      = System.MatrixOfInertia();
    

?

?

4. Conclusion

OpenCASCADE中實(shí)現(xiàn)的Gauss-Legendre求積算法,由于是查表求得Gauss點(diǎn)及求積系數(shù),所以計(jì)算速度快。唯一不足是對(duì)高斯點(diǎn)數(shù)有限制。?

綜上所述,可知數(shù)值計(jì)算在OpenCASCADE中重要作用。一個(gè)TKMath庫(kù)相當(dāng)于實(shí)現(xiàn)了一本《數(shù)值分析》課本中的大部分內(nèi)容。所以有興趣的朋友可結(jié)合《數(shù)值分析》或《計(jì)算方法》之類的書籍,來對(duì)OpenCASCADE的數(shù)學(xué)庫(kù)TKMath進(jìn)行理論聯(lián)系實(shí)際的深入理解。

5. References

1. Wolfram MathWorld, Numerical Integration,??

http://mathworld.wolfram.com/NumericalIntegration.html

2. 易大義,沈云寶,李有法編. 計(jì)算方法. 浙江大學(xué)出版社. 2002?

3. 易大義,陳道琦編. 數(shù)值分析引論. 浙江大學(xué)出版社. 1998?

4. 李慶楊,王能超,易大義.數(shù)值分析.華中理工大學(xué)出版社. 1986?

5. 同濟(jì)大學(xué)數(shù)學(xué)教研室. 高等數(shù)學(xué)(第四版). 高等教育出版社. 1996

OpenCASCADE Gauss Integration


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 二连浩特市| 宁远县| 乐平市| 自治县| 阿拉善左旗| 大余县| 靖远县| 建水县| 南川市| 襄樊市| 鹤壁市| 石门县| 大洼县| 盐亭县| 临夏县| 内乡县| 万荣县| 鄂托克旗| 淮滨县| 黄平县| 吉水县| 疏勒县| 社旗县| 淮南市| 曲水县| 许昌县| 孝昌县| 佛学| 虞城县| 武强县| 仁寿县| 太湖县| 彩票| 仁布县| 鸡西市| 温泉县| 锡林郭勒盟| 安泽县| 浦东新区| 浙江省| 锡林郭勒盟|