Duzi100
(Duzi100)
#1
Dear Friends

I’m a green hand in using Freefem++, and I sincerely hope get some help form you guys.

There is my question.

How to realize the definition and call of functions with parameter input and output. Just like writing the ".m file " in MATLAB.

I will be every grateful for your solution.

You have to 2 ways:

// a line function

```
func foo = t+y; // here the variable t mush be define before , x will be the current abcisse.
```

// a more complexe function ,

func real J(real[int] & Z){

Vh u ;

u[]=Z;

real s = int2d(Th)(Ie*(u-ud)^2);

return s;

```
}
```

or use a macro generation as like a function

macro f(x) (x)*2 //

and finally you can put all the definition aN .idp file and include it.

Duzi100
(Duzi100)
#3
Thanks a lot for your solutions with so many details. I will try to program as these examples one by one.