# Code for the average function

**URL:** <https://community.freefem.org/t/code-for-the-average-function/2472>\
**Category:** General Discussion\
**Created:** [May 18, 2023, 12:20pm UTC](https://community.freefem.org/t/code-for-the-average-function/2472 "2023-05-18T12:20:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![junjie](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@junjie](https://community.freefem.org/u/junjie)\
**Post date:** [May 18, 2023, 12:20pm UTC](https://community.freefem.org/t/code-for-the-average-function/2472/1 "2023-05-18T12:20:00Z")

</div>

Hello everyone, I’m a little confused about the average function in freefem, and I’m wondering what the code behind this command is. Because I want to implement the average value defined in the picture below in freefem.In this image, the definition of the mean is defined with two real parameters sums of 1. I want to implement it in freefem based on the average function command code.

 ![VDVPVR0HCBW6@HIW5RTEAD6](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/2/204eadefde21de552e4a736c28f8dbe60471830e.png)
