# Natural Log and e (exponent) functions

**URL:** <https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613>\
**Category:** Ask for Help\
**Tags:** custom-code\
**Created:** [January 16, 2024, 2:37pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613 "2024-01-16T14:37:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![corbmore](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/corbmore/32/69365_2.png) [@corbmore](https://community.glideapps.com/u/corbmore)\
**Post date:** [January 16, 2024, 2:37pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/1 "2024-01-16T14:37:32Z")

</div>

Hey guys. I’m new to no/low code apps so feel free to explain it like I’m a 5 year old.

I’m creating a calculator from an excel model and there’s a hand-full of excel expressions that I’ve had to “work around” in my math. Ultimately the output comes down to an exponential function that will require the usage of both natural log (LN) and exponent (e). I spent some time looking around in the community and help for supported math fx’s and didn’t see those listed.

FWIW…the actual set up is pretty straightforward. I have a column that takes the natural log (or exponent) of a record.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 16, 2024, 2:44pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/2 "2024-01-16T14:44:48Z")

</div>

You can do LOG and exponents in a Math column. What is the formula you are trying to reproduce? And do you have an example of values you are feeding the formula and the expected result?

---

<div class="post-metadata">

**Author:** ![corbmore](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/corbmore/32/69365_2.png) [@corbmore](https://community.glideapps.com/u/corbmore)\
**Post date:** [January 16, 2024, 3:43pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/3 "2024-01-16T15:43:01Z")

</div>

Thanks for the quick reply, Jeff. Unfortunately LOG and LN (natural log) are NOT the same thing.

> **[Difference Between Log and Ln (Logarithm v/s Natural Log)](https://byjus.com/maths/difference-between-ln-and-log/)**
>
> The basic difference between log and ln is that log is represented with base 10 and ln is denoted by base e, where e is the exponential function. Learn logarithm and natural logarithm differences with example at BYJU'S.

> **[Logarithm](https://en.wikipedia.org/wiki/Logarithm)**
>
> In mathematics, the logarithm is the inverse function to exponentiation. That means that the logarithm of a number x to the base b is the exponent to which b must be raised to produce x. For example, since 1000 = 103, the logarithm base 10 of 1000 is 3, or log10 (1000) = 3. The logarithm of x to base b is denoted as logb (x), or without parentheses, logb x, or even without the explicit base, log x, when no confusion is possible, or when the base does not matter such as in big O notation.
> The ...

Similarly the exponent “e” is NOT the same as X^2, or X^10 (see the links above). If you’re more familiar with excel, the formula for “e” is “EXP(x)”, where e^1 or EXP(1) =2.7183.

* * *

The base equation I’m solving for and using in my app is the natural decay equation. y=Ae(kt) or y=A_e^(k_t).  
t is time  
A is a constant (i’m solving for)  
k is the decay rate and a constant I’m solving for

I’ve figured out how to do the basic operations (+,-,\* and /) in glide, but need to find a way (if possible) to calculate LN and e.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 16, 2024, 3:59pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/4 "2024-01-16T15:59:31Z")

</div>

Something like this in a javascript column? I’m not sure if that’s exactly what you’re looking for. That’s why I asked for a current sample formula that you are using in excel and a sample result.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/8/b804a84eff3ba7a1ba061dec2351fcc45a2deef5.png)

```auto
function naturalDecay(initialQuantity, decayConstant, time) {
    return initialQuantity * Math.exp(-decayConstant * time);
}

return naturalDecay(p1, p2, p3);

```

---

<div class="post-metadata">

**Author:** ![Dilon\_Perera](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/dilon_perera/32/85652_2.png) [@Dilon\_Perera](https://community.glideapps.com/u/Dilon_Perera)\
**Post date:** [January 16, 2024, 3:59pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/5 "2024-01-16T15:59:38Z")

</div>

🤔

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/c/1c98e0897bc88bc1891612804e78542f690a4768.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/f/efe7c290cb4e57f20958e78a5678ae697bac8111.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/5/e58e1ab90818ed5c3b3bfe8b87c741e49c140137.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/5/2525d596ee02eef9476a319b6a62ea9c68ec01c0.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/2/9260048cdc130a80d858cfb8aaa58f470d15c8ff.png)  
[https://lesterlyu.github.io/fast-formula-parser/index.html](https://lesterlyu.github.io/fast-formula-parser/index.html)

---

<div class="post-metadata">

**Author:** ![corbmore](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/corbmore/32/69365_2.png) [@corbmore](https://community.glideapps.com/u/corbmore)\
**Post date:** [January 16, 2024, 10:43pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/6 "2024-01-16T22:43:12Z")

</div>

Thank you Dilon. I messed around with this some. It appears to only work on a single value? Is there a way to perform the calcs for an entire column? I have an entire column of data that I need to take the “natural log” of.

Data (input) LN (Data)  
350 LN(350)  
300 LN (300)  
325 LN(325)  
310 …  
…

Same for the EXP or “e”.

---

<div class="post-metadata">

**Author:** ![corbmore](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/corbmore/32/69365_2.png) [@corbmore](https://community.glideapps.com/u/corbmore)\
**Post date:** [January 16, 2024, 10:57pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/7 "2024-01-16T22:57:30Z")

</div>

Thank you, Jeff. Here’s a bit more clarity. Produce is an Input from the user. Each row will have to be calculated like the excel screencap. I was able to use the “Excel Formula” option but I was only able to perform the task on a single value. I’m new to this, would using a java script be better?

| Produce | LN (Produce) |
| --- | --- |
| 346 | 5.84643878 |
| 357 | 5.87773578 |
| 321 | 5.77144112 |
| 204 | 5.31811999 |
| 210 | 5.34710753 |
| 234 | 5.45532112 |
| 126 | 4.83628191 |
| 130 | 4.86753445 |
| 120 | 4.78749174 |

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [January 16, 2024, 11:37pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/8 "2024-01-16T23:37:07Z")

</div>

Not sure why it’s “only able to perform the task on a single value”? If you add a column like Jeff or Dilon showed, wouldn’t it apply to every row? Can you add a screenshot?

---

<div class="post-metadata">

**Author:** ![corbmore](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/corbmore/32/69365_2.png) [@corbmore](https://community.glideapps.com/u/corbmore)\
**Post date:** [January 16, 2024, 11:51pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/9 "2024-01-16T23:51:34Z")

</div>

Perfect Timing! I just figured it out. I wasn’t referencing the column properly. Thank you

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [January 23, 2024, 11:52pm UTC](https://community.glideapps.com/t/natural-log-and-e-exponent-functions/69613/10 "2024-01-23T23:52:04Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
