log overloads the natural logarithm. In addition to the natural logarithm, YALMIP also overloads log2 and log10.

Since logarithms easily causes numerical issues in nonlinear solvers, so to avoid some problems YALMIP also has a special construction \( \log(1+x)\) (shifted log) which automatically is extracted from models. For the same reason, YALMIP automatically detects so called perspective logarithms \(x\log(y/x)\).


y = log(x)
y = log2(x)
y = log10(x)
y = slog(x) % Shifted log, typically not used manually
y = log(1+x)
y = log(1+x)
Nonlinear scalar (real, models 'slog', 1 variable)


Logarithmic functions are implemented as convexity aware callback operators, except when Mosek 9, SCS or ECOS are used and the exponential cone description is exploited in a graph representation.