Is there a logarithm function in Craft or Twig?
The short answer is no... because Twig is a templating language, and Craft doesn't otherwise have a general need for a log type of function.

The longer answer is you can very easily build this yourself!


Grab the Business Logic Template.
Delete the services and controllers folders... you won't need them.
In the BusinessLogicVariable.php file, change exampleVariable to payoffTime. Whatever parameters you assign to this function will correspond to the parameters you'll use when calling this variable from Twig.
Set whatever logic you want within the function, and return the resulting value.
Enable the plugin from your Control Panel.
Call that variable from your Twig template!

{% set payoffTime = craft.businessLogic.payoffTime(foo, bar) %}





UPDATE

Here's an example based on the use case you outlined in the comments below...

Twig:

{% set payoffTime = craft.businessLogic.payoffTime(entry.loanAmount, entry.loanPayment) %}


PHP:

public function payoffTime($loanAmount, $loanPayment)


Alternatively, if you wanted to, you could even pass the whole entry object in as a single parameter, and just use its field values once you're on the PHP side of things...

Twig:

{% set payoffTime = craft.businessLogic.payoffTime(entry) %}


PHP:

public function payoffTime($entry)
{
    // $entry-&gt;loanAmount
    // $entry-&gt;loanPayment
}