Previous Up Next

20.2.6  Logarithmic regression

You might expect a set of points to lie on a logarithmic curve y=m ln(x)+b. The logarithmic_regression command finds the logarithmic curve of best fit.

Example

evalf(logarithmic_regression([[1,1],[2,4],[3,9],[4,16]]))

or:

evalf(logarithmic_regression([1,2,3,4],[1,4,9,16]))

(where the evalf is used to get a numeric approximation to an exact expression):

     
10.1506450002,−0.564824055818           

so the best fit logarithmic curve will be y=10.1506450002 ln(x) −0.564824055818.

The logarithmic_regression_plot command draws the best fit logarithmic curve.

Example

logarithmic_regression_plot([1,2,3,4],[1,4,9,16])

Previous Up Next