Outputs the logarithm of a number by a given base.

Logarithm

Inputs

  • Number: The target number
  • Base: The base to raise (defaults to e if unwired)

Outputs

  • Logarithm: The Exponent in the (Base ^ Exponent = Number)

Which can be written as:

Notes

Logarithm is used as an inverse function for the function Power. This function is most commonly used for board game AIs. If you manage to learn how to make an AI, this function will be surely handy for you!

Examples

If you're looking for examples, surely all examples for this is complex. The simplest example is that you can compute a number's length by plugging 10 into the base and flooring it, and finally by adding 1.

Get Num Length

Logarithm is such an advanced function to be common in simple games. But if you really want to see how it can be used, one example is Sounak9434's MCTS Engine, a type of AI used for board games.

  • Logarithm is used in the MCTS Engine as a function to find the best possible moves the AI can execute in the set of given possible moves and the players possible moves in the game.
  • MCTS Engine is made before the logarithm function is implemented. The function that was used before in the MCTS engine is a custom script made by Potato Chan.