ArcGIS Pro 3.0.2: How to calculate the Ln(x) with Arcade?

1072
4
Jump to solution
07-04-2023 02:46 AM
JamalNUMAN
Legendary Contributor

ArcGIS Pro 3.0.2: How to calculate the Ln(x) with Arcade?

 

I observed that the Ln(x) is not available in the list of “Helpers”.

 

But mathematically, Ln(x) = 2.403 Log(x)

 

What is shocking is that the Log (x) in Arcade calculates the Ln(x) but not Log(x)

 

What could be the issue here?

 

 

Clip_166.jpgClip_167.jpgClip_168.jpgClip_169.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos
1 Solution

Accepted Solutions
DanielFox1
Esri Contributor

Hi @JamalNUMAN 

I would recommend using the Python code for this, it looks like something is missing in the Arcade section and I would suggest raising this with your distributor to have it raised as an enhancement for future releases or raise this within the Esri Ideas page.

I have noticed that if you use Python and this function it should get you the desired outcome 

Using math.log10() gives you a logarithmic value as seen below 

DanielFox1_3-1688469008374.pngDanielFox1_4-1688469044482.png

 

If you use math.log() this will perform the inverse log giving you the natural log (Ln) 

DanielFox1_2-1688468941300.png

DanielFox1_5-1688469085240.png

I hope this has helped.

The Log() expression in Arcade is described to return the following 

"Returns the natural logarithm (base E) of a."

Calculate Field expressions

 

 

 

 

View solution in original post

4 Replies
DanielFox1
Esri Contributor

Hi @JamalNUMAN 

I would recommend using the Python code for this, it looks like something is missing in the Arcade section and I would suggest raising this with your distributor to have it raised as an enhancement for future releases or raise this within the Esri Ideas page.

I have noticed that if you use Python and this function it should get you the desired outcome 

Using math.log10() gives you a logarithmic value as seen below 

DanielFox1_3-1688469008374.pngDanielFox1_4-1688469044482.png

 

If you use math.log() this will perform the inverse log giving you the natural log (Ln) 

DanielFox1_2-1688468941300.png

DanielFox1_5-1688469085240.png

I hope this has helped.

The Log() expression in Arcade is described to return the following 

"Returns the natural logarithm (base E) of a."

Calculate Field expressions

 

 

 

 

JohannesLindner
MVP Frequent Contributor

This is a difference in conventions between programming and mathematics and is completely expected behavior. In many (if not most) programming languages, log(x) calculates the natural logarithm (base e).

This is also described in the respective documentations. For example:

log in Arcade

log in Python

log in Javascript

log in Java

log in C++

etc...


Have a great day!
Johannes
DanPatterson
MVP Esteemed Contributor

or convert from one base to another

ln(x) = log10(x) / log10(e)


... sort of retired...
JamalNUMAN
Legendary Contributor

It works fine with the Python as per the screenshots below

 

Clip_175.jpgClip_176.jpg

----------------------------------------
Jamal Numan
Geomolg Geoportal for Spatial Information
Ramallah, West Bank, Palestine
0 Kudos