# How to input the modulus of gradients

**URL:** <https://community.freefem.org/t/how-to-input-the-modulus-of-gradients/3046>\
**Category:** General Discussion\
**Created:** [March 17, 2024, 9:16am UTC](https://community.freefem.org/t/how-to-input-the-modulus-of-gradients/3046 "2024-03-17T09:16:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxy](https://avatars.discourse-cdn.com/v4/letter/z/f4b2a3/32.png) [@zxy](https://community.freefem.org/u/zxy)\
**Post date:** [March 17, 2024, 9:16am UTC](https://community.freefem.org/t/how-to-input-the-modulus-of-gradients/3046/1 "2024-03-17T09:16:36Z")

</div>

Hi,  
I want to write it:

![屏幕截图 2024-03-17 172556](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/6/64e704e1cb8386df86283195da5a35e98f4ea0f9.png)

I code as:

```auto
macro msquare(u) (dx(u)^2+dy(u)^2)//
mesh Th = buildmesh(c1(10)+c2(10)+c3(10)+c4(10));
fespace Vh(Th,P1);
Vh u,w,oldu,q,f;
Vh v,oldv;
problem fcv([u,v],[w,q])=
        -int2d(Th)(v*w)
        -int2d(Th)(1-0.5*(msquare(u)+msquare(oldu));

```

But it’s wrong:  
Error line number 9, before token +

current line = 9  
Compile error :  
line number :9, +  
error Compile error :  
line number :9, +  
code = 1 mpirank: 0

line 9 is macro msquare(u) (dx(u)^2+dy(u)^2)//

How can I solve it.  
Thank you in advance.

---

<div class="post-metadata">

**Author:** ![cmd](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/cmd/32/67_2.png) [@cmd](https://community.freefem.org/u/cmd)\
**Post date:** [March 17, 2024, 10:49am UTC](https://community.freefem.org/t/how-to-input-the-modulus-of-gradients/3046/2 "2024-03-17T10:49:55Z")

</div>

Not a linear system.

Didn’t multiply by test functions.
