# Element-wise ("vectorial") operation in SageMath

Thanks to this forum, I got running some lines of code in SageMath as follows:

```
def y(x): return RR(sum(map(log, prime_range(1,x))))
y(20)
16.0876044842000
```

It takes the log of all primes less than a real value of `x`

and adds them.

Now I'm looking at dividing the log(prime) by that prime before adding them up. Actually, not even adding them up.

So it seems like a reasonable first step to take out the `sum()`

from the function, but this does not work so well:

```
def y(x): return RR(map(log, prime_range(1,x)))
y(20)
```

yielding an `TypeError: unable to convert '<mapobjectat0x7f7d91273250>' to a real number`

despite leaving `RR`

or permuting its position within the function.

I have not even attempted the second logical step of dividing element-wise by `prime_range(1,x)`

.

Example:

For `y(4)`

it would be

```
log(2) / 2 + log(3) /3
```