# Integration of |∇p|^2

**URL:** https://discourse.julialang.org/t/integration-of-p-2/116671
**Category:** Optimization (Mathematical)
**Created:** [July 5, 2024, 4:49pm UTC](https://discourse.julialang.org/t/integration-of-p-2/116671 "2024-07-05T16:49:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Banan\_alkafri](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@Banan\_alkafri](https://discourse.julialang.org/u/Banan_alkafri)
#### Post date: [July 5, 2024, 4:49pm UTC](https://discourse.julialang.org/t/integration-of-p-2/116671/1 "2024-07-05T16:49:29Z")

</div>

I want to create a function that integrates the magnitude of the gradient of a polynomial with 2 variables squared. I created a generic polynomial using monomials and calculated |∇p|^2 and now i have a polynomial that consists of two variables and some of the terms have a combination of the two variables. I want to integrate w.r.t x first and then y. I know the general formula of integrating a polynomial but I’m integrating w.r.t one variable only then how can I work it out? I’m don’t want to use any package that will integrate it directly.

---

<div class="post-metadata">

### Author: ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)
#### Post date: [July 5, 2024, 7:51pm UTC](https://discourse.julialang.org/t/integration-of-p-2/116671/2 "2024-07-05T19:51:05Z")

</div>

Perhaps Polynomials.jl has part of the solution?

---

<div class="post-metadata">

### Author: ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)
#### Post date: [July 5, 2024, 8:03pm UTC](https://discourse.julialang.org/t/integration-of-p-2/116671/3 "2024-07-05T20:03:47Z")

</div>

> [@Banan\_alkafri](#):
>
> I know the general formula of integrating a polynomial but I’m integrating w.r.t one variable only then how can I work it out?

I think you simply want to treat the other variable as a constant.

---

<div class="post-metadata">

### Author: ![Banan\_alkafri](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@Banan\_alkafri](https://discourse.julialang.org/u/Banan_alkafri)
#### Post date: [July 5, 2024, 9:20pm UTC](https://discourse.julialang.org/t/integration-of-p-2/116671/4 "2024-07-05T21:20:47Z")

</div>

yes, this is what I want to do.
