# About array operations

**URL:** <https://community.freefem.org/t/about-array-operations/2125>\
**Category:** General Discussion\
**Created:** [November 17, 2022, 10:58am UTC](https://community.freefem.org/t/about-array-operations/2125 "2022-11-17T10:58:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yangshen](https://avatars.discourse-cdn.com/v4/letter/y/838e76/32.png) [@Yangshen](https://community.freefem.org/u/Yangshen)\
**Post date:** [November 17, 2022, 10:58am UTC](https://community.freefem.org/t/about-array-operations/2125/1 "2022-11-17T10:58:46Z")

</div>

Hello everyone,  
I want to calculate the following equation.  
lowmin = xval - 10\*(xmax-xmin);  
I want to calculate the following formula, where lowmin, xmax, and xmin are arrays of n rows and one column. But it was wrong.  
The code is as follows

real[int]lowmin(5),xmax(5),xmin(5),xval(5);  
xmax=1;  
xmin=0.1;  
xval=0.5;  
lowmin = xval - 10\*(xmax-xmin);

---

<div class="post-metadata">

**Author:** ![miguelpicos](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@miguelpicos](https://community.freefem.org/u/miguelpicos)\
**Post date:** [November 17, 2022, 12:08pm UTC](https://community.freefem.org/t/about-array-operations/2125/2 "2022-11-17T12:08:54Z")

</div>

Hello,  
I did also have some problems at first with this kind of operations. FreeFEM does not support that operation as it needs to store a temporal array in memory to compute the whole operation. You can achieve the same result either with a loop (not recommended) or using other operations which does not need to store data in temporal arrays, for example:

```auto
real[int]lowmin(5),xmax(5),xmin(5),xval(5);
xmax=1;
xmin=0.1;
xval=0.5;
lowmin = 10*xmin-10*xmax;
lowmin += xval;

```

---

<div class="post-metadata">

**Author:** ![Yangshen](https://avatars.discourse-cdn.com/v4/letter/y/838e76/32.png) [@Yangshen](https://community.freefem.org/u/Yangshen)\
**Post date:** [November 17, 2022, 1:21pm UTC](https://community.freefem.org/t/about-array-operations/2125/3 "2022-11-17T13:21:49Z")

</div>

fine  
thank you very much.
