Logarithm of a BigDecimal

Java Number Cruncher: The Java Programmer’s Guide to Numerical Computing provides a solution using Newton’s Method. Source code from the book is available here. The following has been taken from chapter 12.5 Big Decimal Functions (p330 & p331): /** * Compute the natural logarithm of x to a given scale, x > 0. */ public … Read more

set ticks with logarithmic scale

import matplotlib from matplotlib import pyplot as plt fig1, ax1 = plt.subplots() ax1.plot([10, 100, 1000], [1,2,3]) ax1.set_xscale(‘log’) ax1.set_xticks([20, 200, 500]) ax1.get_xaxis().set_major_formatter(matplotlib.ticker.ScalarFormatter()) or ax1.get_xaxis().get_major_formatter().labelOnlyBase = False plt.show()