Skip to content

Logarithm and exponential function nodes (ln, log10, exp) #3

Description

@Yaraslaut

Problem

function.hpp offers integer powers, roots and pi. Test methods also use natural logarithm, decimal logarithm and exponential of a dimensionless expression — to linearise a measured quantity, to state a model curve, or to express a result on a logarithmic axis. Today a consumer has to declare each of them as an opaque operation, so the page renders them as a call and the trace marks them [inside not shown], although they are ordinary functions a method writes out.

Wanted

  • formula::ln(expr), formula::log10(expr), formula::exp(expr) as function nodes, rendered in every dialect (ln x, \ln, \log_{10}, e^{x} / \exp) and traced step by step like sqrt.
  • The operand must be dimensionless — a dimensioned argument is a compile error in the library's own words, as for addends that disagree.
  • A general real power pow(base, exponentExpr) with both dimensionless, or a note on why it is out of scope.

Open points

  • Exact evaluation. The results are irrational almost everywhere. Should checked_evaluate (always exact) refuse a formula that contains one, or round it at a declared precision, as rounded_sqrt does? checked_evaluate_si<double> can answer directly.
  • Domain. ln/log10 of zero or a negative value should be DomainError, never NaN or -inf, under both representations.
  • Absence. An absent operand stays absent, like every other node.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions