Usage
Main.BestApproximation.best_approx
— Methodbest_approx(n::Number, I::AbstractRange, J::AbstractRange)
best_approx(n::Number, I_max::Integer, J::Integer)
For a given number $n$, given two ranges $I$ and $J$, finds the nicest solution such that
\[i^j \approx n \text{ for } i \in I, j \in j.\]
Returns (i, j)
as a tuple.
Given integers $I_{\text{max}}$ and $J_{\text{max}}$ it will assume the ranges between $I = \left\lbrack 1, I_{\text{max}}\right\rbrack$ and $J = \left\lbrack 1, J_{\text{max}}\right\rbrack$.
This is a much slower variant than the other method for best_approx
. It is recommended that you use the "cleverer" method unless you need to constrict the exponent.
Main.BestApproximation.best_approx
— Methodbest_approx(n::Number, R::AbstractRange)
best_approx(n::Number, R_max::Integer)
For a given number $n$, given a range $R$, finds the "nicest" solution of $m$ such that
\[r^m \approx n \text{ for } r \in R.\]
Returns (r, m)
as a tuple.
Given an integer $R_{\text{max}}$ it will assume the range between $R = \left\lbrack 1, R_{\text{max}}\right\rbrack$.