# How do I use FastGaussQuadrature.jl to compute the integral of a 2d triangle element and 3d tetrahedron element

**URL:** <https://discourse.julialang.org/t/how-do-i-use-fastgaussquadrature-jl-to-compute-the-integral-of-a-2d-triangle-element-and-3d-tetrahedron-element/102376>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 1, 2023, 10:31pm UTC](https://discourse.julialang.org/t/how-do-i-use-fastgaussquadrature-jl-to-compute-the-integral-of-a-2d-triangle-element-and-3d-tetrahedron-element/102376 "2023-08-01T22:31:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 1, 2023, 11:56pm UTC](https://discourse.julialang.org/t/how-do-i-use-fastgaussquadrature-jl-to-compute-the-integral-of-a-2d-triangle-element-and-3d-tetrahedron-element/102376/2 "2023-08-01T23:56:43Z")

</div>

> [@00krishna](#):
>
> However, for solving 2 and 3 dimensional elements, I imagine I need to use a package like `FastGaussQuadrature.jl`.

FastGaussQuadrature constructs 1d quadrature rules. Of course, you can integrate over a 2d or 3d region by doing nested integrals (either with QuadGK or via tensor products of quadrature rules), or you can use a multi-dimensional integration package like [HCubature.jl](https://github.com/JuliaMath/HCubature.jl). See also

> [@2D integration over non-rectangular domain using cubature](https://discourse.julialang.org/t/2d-integration-over-non-rectangular-domain-using-cubature/2991):
>
> Hello everyone, I have a very basic question. I’m looking for the most efficient way to perform the following very classical integral: [image] For now I’m using hquadrature of the cubature package in two steps. This works, but I’m not sure whether this is the most efficient way. More generally, I would like to know, how to perform multidimensional integration over non-rectangular domains. It seems cubature does not allow bounds to be functions. Am I correct? Many thanks in advance Olivi…

If you want a fixed-order quadrature rule for a 2d triangle or 3d tetrahedron, see e.g. the [SimplexQuad.jl package](https://github.com/eschnett/SimplexQuad.jl), or [FEMQuad.jl](https://github.com/JuliaFEM/FEMQuad.jl), or the [quadrature routines in NESSie.jl](https://tkemmer.github.io/NESSie.jl/latest/lib/quadrature/) or …

---

_[View the full topic](https://discourse.julialang.org/t/how-do-i-use-fastgaussquadrature-jl-to-compute-the-integral-of-a-2d-triangle-element-and-3d-tetrahedron-element/102376)._
