2

I would like to ask how can I set arbitrary base of logarithm in gnuplot (I would need f(x)=x^{1+9log2(x)} function to plot).

2 Answers 2

3

It seems like there are only builtin functions for the natural log and log10. But you can easily change the base of the logarithm.

log_b(x) = log_k(x) / log_k(b)

Thus, you can rewrite your formula as

f(x) = x**(1 + 9 * log(x)/log(2))
0
3

To expand upon the answer of tobias_k, you can create a user-defined function which takes the base as a secondary argument:

logb(x, base) = log(x)/log(base)

And then rewrite your formulas as:

f(x) = x**(1 + 9 * logb(x, 2))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.