Logarithm calculation
Hello,
How may I do a logarithm math calculation on Xano. For example: Ln(variable1) / Ln(variable2).
I understand there is Lambda but I need to upgrade for that which I can't do now. I also found this :
Thank you
Best Answers

@Mr Unfreeze GOOD NEWS !!!

Hi Arturo,
Thanks a lot for everything, including asking for the feature to Xano ! You made my life so much easier. Btw, where did you ask for the feature?
@Ray Deck Thank you as well for your response.
Answers

It's strange that Xano has the
exp
math filter but not the inverse, thelog
filter yet.Calling a external API to do this seems like using a sledgehammer to crack a nut.
Here is another suggestion for you.
Create the following custom function and call it log.
Example to calculate log(25):
1) Divide 25 by the nearest power of 10. The condition must be 25 ≥ 10n.
2) The value of n is 1 because 25 ≥ 101. So the initial answer is 1.xxxxxx.
3) Divide 25 by 101. The result is 2.5.
4) Raise 2.5 by 10. So 2.510 ≈ 9536.7
(Note: The number is raised to 10 because we are already looking for the digits after the decimal point.)
5) For the next values, the same process will be used.
6) Divide 9536.7 by the nearest power of 10.
7) 9536.7 ≥ 103 so n=3. The answer is now 1.3xxxxx.
8) 9536.7 / 103 = 9.5367
9) Raise 9.5367 to 10. 9.536710 = 6222733625
10) 6222733625 ≥ 10n so n=9. The answer is now 1.39xxxx.
11) Repeat the same process until you get the desired precision.
12) So log (25) ≈ 1.39794.This also works on logs with bases other than 10, even with decimals. In solving loga(x), just replace 10n with an. Also in solving for n, simply just divide the number by the base repeatedly until you get a quotient nearest to 1. The number of times you divided is n. (ie. 250/10= 25 (1), 25/10=2.5 (2), so n=2)

Arturo's trick is good. I would use a lambda to do the calculation, where the builtin JS math operators are all available. Like:
return Math.log($var.variable1). / Math.log($var.variable2)
(Without a second argument, Math.log defaults to euler's number as the base, making a natural log) 
🤗 Want to submit a feature request? Click here.
Categories
 All Categories
 46 📣 Announcements
 47 🦾 Releases
 36 👋 Welcome
 924 🤷 Help! I'm a Noob
 113 📱 NoCode FrontEnds
 597 🌐 Working with APIs
 418 🔢 Transforming data
 120 🔌 Connect Xano to ...
 46 🧑💻 Find an Expert
 320 ❓Other questions
 32 🔐 Security
 22 ✂️ Snippets
 19 🏆 Showcase
 7 🗣️ Xano Chatter
 60 📺 Video Tutorials
 166 🙏 Request a feature
 219 🐞 Report a Bug
 19 🚀 Templates & Extensions
 6 💬 Feedback